Skip to content

Commit

Permalink
support go modules (#25)
Browse files Browse the repository at this point in the history
* modulize

* Prepare linter

* Use goblet instead of go-bindata.

* Treat Makefile

* Fix lints

* Fix test

* Support module mode (building at out of $GOPATH)

* fix lints

* wip: treat make and circleci-conf

* rename richgo.go to main.go

* Use golangci-lint instead of gometalinter

* Remove gometalinter config

* rollback main.go for master(richgo.go)

* fix samples
  • Loading branch information
kyoh86 authored Mar 9, 2019
1 parent 906501c commit c50f72d
Show file tree
Hide file tree
Showing 471 changed files with 204 additions and 184,957 deletions.
59 changes: 32 additions & 27 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
version: 2
jobs:
build:
working_directory: /go/src/github.com/kyoh86/richgo
working_directory: /home/projects/github.com/kyoh86/richgo
docker:
- image: kyoh86/gotest
- image: kyoh86/gotest:latest
steps:
- checkout
- run:
name: go test
command: "go test -race ./..."
cover:
working_directory: /go/src/github.com/kyoh86/richgo
docker:
- image: kyoh86/gotest
steps:
- checkout
name: install
command: go install ./...
- run:
name: take a coverage
command: "goverage -coverprofile=coverage.out ./..."
name: test and take coverage
command: |
mkdir -p .circleci/test/gotest
go test -v -race -coverprofile=coverage.out ./... | go-junit-report > .circleci/test/gotest/results.xml;
- run:
name: upload a coverage
command: "bash <(curl -s https://codecov.io/bash)"
lint:
working_directory: /go/src/github.com/kyoh86/richgo
name: upload coverage
command: bash <(curl -s https://codecov.io/bash)
- run:
name: search lints
command: golangci-lint run


release:
working_directory: /home/projects/github.com/kyoh86/richgo
docker:
- image: kyoh86/gotest
- image: kyoh86/gotest:latest
steps:
- checkout
- run:
name: search lints
command: "gometalinter --config /etc/gometalinter/config.json ./... > ./lints.txt || :"
- run:
name: reviewdog
command: "cat ./lints.txt | reviewdog -f=golint -ci=circle-ci"
name: run goreleaser
command: curl -sL https://git.io/goreleaser | bash

workflows:
version: 2
commit:
jobs:
- build
- cover:
requires:
- build
- lint:
- build:
filters:
branches:
only: /.*/
tags:
only: /.*/
- release:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}$/
36 changes: 15 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# goreleaser
# for goreleaser output with .goreleaser.yml
/dist

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
# for man file
/richgo.1

_testmain.go
# go-junit-report output in .circleci/config
/.circleci/test

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test
*.prof

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters:
enable:
- unparam
- scopelint
55 changes: 0 additions & 55 deletions Gopkg.lock

This file was deleted.

72 changes: 0 additions & 72 deletions Gopkg.toml

This file was deleted.

28 changes: 16 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
.PHONY: default gen test vendor install sample
.PHONY: gen lint test install man sample

default:
echo use gen, test, vendor or install
VERSION := `git vertag get`
COMMIT := `git rev-parse HEAD`

gen:
go-bindata -o editor/test/output_test.go -pkg test -prefix sample/out_ ./sample/out_*.txt
goblet -g -p test -o editor/test/output_test.go --ignore-dotfiles ./sample/out_*.txt
gofmt -w editor/test/output_test.go

test:
go test ./...
lint: gen
golangci-lint run

sample:
sample/run.sh
test: lint
go test -v --race ./...

install: test
go install -a -ldflags "-X=main.version=$(VERSION) -X=main.commit=$(COMMIT)" ./...

vendor:
dep ensure
man: test
go run main.go --help-man > richgo.1

install:
go install ./...
sample:
sample/run.sh
2 changes: 2 additions & 0 deletions config/color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestMarshalYAML(t *testing.T) {
`c: '#ffeedd'`: {Color{Type: ColorType24Bit, ValueR: 0xff, ValueG: 0xee, ValueB: 0xdd}},
`c: 31`: {Color{Type: ColorType8Bit, Value8: 31}},
} {
color := color
buf, err := yaml.Marshal(&color)
if err != nil {
t.Errorf("failed to marshal a color %q to yaml with error %q", "black", err)
Expand All @@ -47,6 +48,7 @@ func TestMarshalJSON(t *testing.T) {
`{"c":"#ffeedd"}`: {C: Color{Type: ColorType24Bit, ValueR: 0xff, ValueG: 0xee, ValueB: 0xdd}},
`{"c":31}`: {C: Color{Type: ColorType8Bit, Value8: 31}},
} {
color := color
buf, err := json.Marshal(&color)
if err != nil {
t.Errorf("failed to marshal a color to json with error %q", err)
Expand Down
1 change: 1 addition & 0 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func Load() {
C = *actualConfig(c)
}

// Default is the default configuration
func Default() {
C = *actualConfig(&defaultConfig)
}
Expand Down
Loading

0 comments on commit c50f72d

Please sign in to comment.