Skip to content
This repository was archived by the owner on May 11, 2022. It is now read-only.

Commit d4b10a8

Browse files
committed
sync with go tool template
1 parent db18c14 commit d4b10a8

File tree

342 files changed

+35051
-17575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+35051
-17575
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/.github/ export-ignore
77
/bin/ export-ignore
8+
/tools/ export-ignore
89

910
Makefile export-ignore
1011
*.md export-ignore

.travis.yml

+27-23
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
sudo: false
21
language: go
2+
os: linux
33

44
cache:
55
directories:
6-
- $HOME/.cache/go-build
7-
- $HOME/gopath/pkg/mod
6+
- "$HOME/.cache/go-build"
7+
- "$HOME/gopath/pkg/mod"
88

99
env:
1010
global:
@@ -16,35 +16,39 @@ go:
1616
- 1.11.x
1717
- 1.12.x
1818
- 1.13.x
19+
- 1.14.x
1920

20-
matrix:
21+
go_import_path: github.com/kamilsk/check
22+
23+
jobs:
2124
allow_failures:
2225
- go: master
2326

2427
before_script:
25-
- |
26-
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
27-
curl -L $CODECLIMATE > bin/cc-test-reporter
28-
chmod +x bin/cc-test-reporter
29-
bin/cc-test-reporter before-build
30-
fi
28+
- |
29+
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then
30+
curl -L $CODECLIMATE > /home/travis/gopath/bin/cc-test-reporter
31+
chmod +x /home/travis/gopath/bin/cc-test-reporter
32+
cc-test-reporter before-build
33+
fi
3134
3235
script:
33-
- |
34-
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
35-
make test-with-coverage-profile
36-
else
37-
make test
38-
fi
36+
- |
37+
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then
38+
make test-with-coverage-profile
39+
else
40+
make test
41+
fi
3942
4043
after_script:
41-
- |
42-
if [[ $TRAVIS_GO_VERSION == 1.13* ]]; then
43-
bin/cc-test-reporter after-build -t gocov -p $(basename $(go list -m)) --exit-code $TRAVIS_TEST_RESULT
44-
if [[ $TRAVIS_TAG ]]; then
45-
curl -sL https://git.io/goreleaser | bash
44+
- |
45+
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then
46+
cc-test-reporter after-build -t gocov -p $(basename $(go list -m)) --exit-code $TRAVIS_TEST_RESULT
47+
if [[ $TRAVIS_TAG ]]; then
48+
curl -sL https://git.io/goreleaser | bash
49+
fi
4650
fi
47-
fi
4851
4952
notifications:
50-
slack: octolab:1eMS7IqOArBipiu31jYVd0cN
53+
slack:
54+
secure: VHWCBgcxc9BejOM9pSTqAyXzZN6DEW/UzJKGkNX+lWL1wREIDmJ7iFKM1ZUfTwU6j5WtOE4ruJlfpUlmmlzicqTZUBIkGCJH6LoX9kwP+6IKBD/aCFuGwRuptKKU0I8pLV6Jvs2m2WQBlKQrfSX9IIM4zqb0M+ST067huwRscJP/4bJJ2aPg+dQiGeR3VHLit/izMRzk/IjnT093i3qGlXDhdRZrxnlqd5flmSlnU5sBTfRr9wHcMdrxIXK3smhay/w8M7XeuIgpv9mUjizmg5e+bQkm4e8AZZxYasvUQAdLWWylcwMk9xPHYy9QGKRFTSl1weon6rRrXWVXP1b9PpR8PYeg1qPvV0k+QNKokDdveqzd2N6ZAilRqAMNVYYYnI1fgLTySfBdIXKMwZAM8OnQk0BBBfyPp+FkoB/zewC6pFy54w7gM2pjefdV3RWjOsc6ux/W6Ro2msZufDW1OzJU4Yj4uzWCtZdsjjkGcA2fB9cDQWlhhmkYVpc7tDfhQ2GFgRmTvuvCvZP2jfUbHcMTgK1CW0+zbX5gsGorWCrMvHL6boV3iRydndOvCFKBUFdDDPvKBjbRIJRuoNprpSmhjWwRYZdUUD+HU/S64vm4mKiWoLhP3hUeDHKSg26F7GomvEGoVz2MCkaqXteRUi9tAhNJIjy88a/l354IMWg=

Makefile

+79-37
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,67 @@ go-env:
3939
@echo "PATHS: $(strip $(PATHS))"
4040
@echo "TIMEOUT: $(TIMEOUT)"
4141

42-
.PHONY: deps
43-
deps:
44-
@go mod tidy
45-
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi
42+
.PHONY: deps-check
43+
deps-check:
44+
@go mod verify
45+
@if command -v egg > /dev/null; then \
46+
egg deps check license; \
47+
egg deps check version; \
48+
fi
4649

4750
.PHONY: deps-clean
4851
deps-clean:
4952
@go clean -modcache
5053

54+
.PHONY: deps-shake
55+
deps-shake:
56+
@go mod tidy
57+
58+
.PHONY: module-deps
59+
module-deps:
60+
@go mod download
61+
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi
62+
5163
.PHONY: update
52-
update: selector = '.Require[] | select(.Indirect != true) | .Path'
64+
update: selector = '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'
5365
update:
5466
@if command -v egg > /dev/null; then \
5567
packages="`egg deps list`"; \
56-
go get -mod= -u $$packages; \
57-
elif command -v jq > /dev/null; then \
58-
packages="`go mod edit -json | jq -r $(selector)`"; \
59-
go get -mod= -u $$packages; \
6068
else \
61-
packages="$(shell cat go.mod | grep -v '// indirect' | grep '\t' | awk '{print $$1}')"; \
62-
go get -mod= -u $$packages; \
63-
fi
69+
packages="`go list -f $(selector) -m all`"; \
70+
fi; go get -d -mod= -u $$packages
71+
72+
.PHONY: update-all
73+
update-all:
74+
@go get -d -mod= -u ./...
75+
76+
.PHONY: format
77+
format:
78+
@goimports -local $(LOCAL) -ungroup -w $(PATHS)
79+
80+
.PHONY: go-generate
81+
go-generate:
82+
@go generate $(PACKAGES)
83+
84+
.PHONY: lint
85+
lint:
86+
@golangci-lint run ./...
87+
88+
.PHONY: test
89+
test:
90+
@go test -race -timeout $(TIMEOUT) $(PACKAGES)
91+
92+
.PHONY: test-clean
93+
test-clean:
94+
@go clean -testcache
95+
96+
.PHONY: test-with-coverage
97+
test-with-coverage:
98+
@go test -cover -timeout $(TIMEOUT) $(PACKAGES) | column -t | sort -r
99+
100+
.PHONY: test-with-coverage-profile
101+
test-with-coverage-profile:
102+
@go test -cover -covermode count -coverprofile c.out -timeout $(TIMEOUT) $(PACKAGES)
64103

65104
BINARY = $(BINPATH)/$(shell basename $(MAIN))
66105
BINPATH = $(PWD)/bin
@@ -99,40 +138,43 @@ install:
99138
install-clean:
100139
@go clean -cache
101140

102-
.PHONY: test
103-
test:
104-
@go test -race -timeout $(TIMEOUT) $(PACKAGES)
105-
106-
.PHONY: test-clean
107-
test-clean:
108-
@go clean -testcache
109-
110-
.PHONY: test-with-coverage
111-
test-with-coverage:
112-
@go test -cover -timeout $(TIMEOUT) $(PACKAGES) | column -t | sort -r
113-
114-
.PHONY: test-with-coverage-profile
115-
test-with-coverage-profile:
116-
@go test -cover -covermode count -coverprofile c.out -timeout $(TIMEOUT) $(PACKAGES)
141+
.PHONY: dist-check
142+
dist-check:
143+
@goreleaser --snapshot --skip-publish --rm-dist
117144

118-
.PHONY: dist
119-
dist:
145+
.PHONY: dist-dump
146+
dist-dump:
120147
@godownloader .goreleaser.yml > bin/install
121148

122-
.PHONY: format
123-
format:
124-
@goimports -local $(LOCAL) -ungroup -w $(PATHS)
149+
TOOLFLAGS = -mod=
125150

126-
.PHONY: generate
127-
generate:
128-
@go generate $(PACKAGES)
151+
.PHONY: tools-env
152+
tools-env:
153+
@echo "GOBIN: `go env GOBIN`"
154+
@echo "TOOLFLAGS: $(TOOLFLAGS)"
155+
156+
.PHONY: toolset
157+
toolset:
158+
@( \
159+
GOFLAGS=$(TOOLFLAGS); \
160+
cd tools; \
161+
go mod download; \
162+
if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi; \
163+
go generate tools.go; \
164+
)
129165

130166

131167
.PHONY: clean
132168
clean: build-clean deps-clean install-clean test-clean
133169

170+
.PHONY: deps
171+
deps: module-deps toolset
172+
134173
.PHONY: env
135-
env: go-env build-env
174+
env: go-env build-env tools-env
175+
176+
.PHONY: generate
177+
generate: go-generate format
136178

137179
.PHONY: refresh
138-
refresh: update deps generate format test build
180+
refresh: deps-shake update deps generate format test build

README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ $ go get -u github.com/kamilsk/check
6767
$ egg tools add github.com/kamilsk/check
6868
```
6969

70-
> [egg][egg.page]<sup id="anchor-egg">[1](#egg)</sup> is an `extended go get`.
70+
> [egg][]<sup id="anchor-egg">[1](#egg)</sup> is an `extended go get`.
7171
7272
### Bash and Zsh completions
7373

@@ -82,14 +82,11 @@ $ check completion zsh > /path/to/zsh-completions/_check.zsh
8282

8383
made with ❤️ for everyone
8484

85-
[build.icon]: https://travis-ci.org/kamilsk/check.svg?branch=master
8685
[build.page]: https://travis-ci.org/kamilsk/check
87-
86+
[build.icon]: https://travis-ci.org/kamilsk/check.svg?branch=master
8887
[design.page]: https://www.notion.so/33715348cc114ea79dd350a25d16e0b0?r=0b753cbf767346f5a6fd51194829a2f3
89-
9088
[promo.page]: https://github.com/kamilsk/check
91-
9289
[template.page]: https://github.com/octomation/go-tool
9390
[template.icon]: https://img.shields.io/badge/template-go--tool-blue
9491

95-
[egg.page]: https://github.com/kamilsk/egg
92+
[egg]: https://github.com/kamilsk/egg

bin/activate

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ deactivate () {
6060
}
6161

6262
deps () {
63-
go mod tidy
63+
go mod download
6464
if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi
6565
}
6666

@@ -96,7 +96,7 @@ _OLD_PS1="${PS1:-}"
9696

9797
export GO111MODULE=on
9898
export GOBIN="${_BINPATH}"
99-
export GOFLAGS=-mod=vendor
99+
export GOFLAGS=-mod=
100100
export GOPRIVATE=go.octolab.net
101101
export GOPROXY=direct
102102
export PATH="${_BINPATH}:${PATH}"

go.mod

+14-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ module github.com/kamilsk/check
33
go 1.11
44

55
require (
6-
github.com/briandowns/spinner v1.8.0
7-
github.com/fatih/color v1.8.0
6+
github.com/PuerkitoBio/goquery v1.5.1 // indirect
7+
github.com/antchfx/htmlquery v1.2.2 // indirect
8+
github.com/antchfx/xmlquery v1.2.3 // indirect
9+
github.com/antchfx/xpath v1.1.4 // indirect
10+
github.com/briandowns/spinner v1.9.0
11+
github.com/fatih/color v1.9.0
12+
github.com/gobwas/glob v0.2.3 // indirect
813
github.com/gocolly/colly v1.2.0
9-
github.com/pkg/errors v0.8.1
10-
github.com/spf13/cobra v0.0.5
11-
github.com/stretchr/testify v1.4.0
12-
go.octolab.org/toolkit/cli v0.0.6
14+
github.com/kennygrant/sanitize v1.2.4 // indirect
15+
github.com/pkg/errors v0.9.1
16+
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
17+
github.com/spf13/cobra v0.0.6
18+
github.com/stretchr/testify v1.5.1
19+
github.com/temoto/robotstxt v1.1.1 // indirect
20+
go.octolab.org/toolkit/cli v0.0.7
1321
)

0 commit comments

Comments
 (0)