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

Commit

Permalink
sync with template and update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Jun 23, 2020
1 parent 7cbd208 commit b05e22b
Show file tree
Hide file tree
Showing 112 changed files with 5,078 additions and 1,738 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/.github/ export-ignore
/bin/ export-ignore
/githooks/ export-ignore
/tools/ export-ignore

Makefile export-ignore
Expand Down
56 changes: 56 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
linters:
fast: true
enable:
- govet
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
- ineffassign
- deadcode
- typecheck

- bodyclose
# - golint
# - rowserrcheck
# - stylecheck
# - gosec
# - interfacer
# - unconvert
# - dupl
# - goconst
# - gocyclo
# - gocognit
# - asciicheck
# - gofmt
# - goimports
# - maligned
# - depguard
# - misspell
# - lll
# - unparam
# - dogsled
# - nakedret
# - prealloc
# - scopelint
- gocritic
# - gochecknoinits
# - gochecknoglobals
# - godox
# - funlen
# - whitespace
# - wsl
# - goprintffuncname
# - gomnd
# - goerr113
# - gomodguard
# - godot
# - testpackage
# - nestif
# - nolintlint
# - megacheck

# - https://github.com/kyoh86/exportloopref
# - https://github.com/kyoh86/looppointer
85 changes: 45 additions & 40 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,55 @@
project_name: lift

archives:
- id: lift
files:
- LICENSE
format: tar.gz
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
386: 32bit
amd64: 64bit
darwin: macOS
linux: Linux
- id: lift
files:
- LICENSE
format: tar.gz
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
386: 32bit
amd64: 64bit
darwin: macOS
linux: Linux

brews:
- name: lift
commit_author:
name: Kamil Samigullin
email: [email protected]
description: Up your service locally.
folder: Formula
homepage: https://github.com/kamilsk/lift
github:
owner: kamilsk
name: homebrew-tap
install: |
bin.install "lift"
output = Utils.popen_read("#{bin}/lift completion bash")
(bash_completion/"lift").write output
output = Utils.popen_read("#{bin}/lift completion zsh")
(zsh_completion/"_lift").write output
prefix.install_metafiles
test: |
system "#{bin}/lift --version"
- name: lift
caveats:
commit_author:
name: Kamil Samigullin
email: [email protected]
description: Up your service locally.
folder: Formula
homepage: https://github.com/kamilsk/lift
github:
owner: kamilsk
name: homebrew-tap
install: |
bin.install "lift"
output = Utils.popen_read("#{bin}/lift completion bash")
(bash_completion/"lift").write output
output = Utils.popen_read("#{bin}/lift completion zsh")
(zsh_completion/"_lift").write output
prefix.install_metafiles
test: |
system "#{bin}/lift version"
builds:
- binary: lift
env:
- CGO_ENABLED=0
goarch:
- 386
- amd64
goos:
- darwin
- linux
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
main: .
- id: lift
binary: lift
env:
- CGO_ENABLED=0
flags:
- -trimpath
goarch:
- 386
- amd64
goos:
- darwin
- linux
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
main: .

checksum: { name_template: checksums.txt }

Expand Down
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ env:
go:
- master
- 1.x
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x

go_import_path: tool

jobs:
allow_failures:
- go: master

before_script:
- |
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then
curl -L $CODECLIMATE > /home/travis/gopath/bin/cc-test-reporter
curl -sL $CODECLIMATE > /home/travis/gopath/bin/cc-test-reporter
chmod +x /home/travis/gopath/bin/cc-test-reporter
cc-test-reporter before-build
fi
Expand All @@ -43,12 +39,17 @@ script:
after_script:
- |
if [[ $TRAVIS_GO_VERSION == 1.14* ]]; then
cc-test-reporter after-build -t gocov -p $(basename $(go list -m)) --exit-code $TRAVIS_TEST_RESULT
if [[ $TRAVIS_TAG ]]; then
curl -sL https://git.io/goreleaser | bash
fi
cc-test-reporter after-build -t gocov -p $(go list -m) --exit-code $TRAVIS_TEST_RESULT
fi
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_GO_VERSION == 1.14*

notifications:
slack:
secure: VHWCBgcxc9BejOM9pSTqAyXzZN6DEW/UzJKGkNX+lWL1wREIDmJ7iFKM1ZUfTwU6j5WtOE4ruJlfpUlmmlzicqTZUBIkGCJH6LoX9kwP+6IKBD/aCFuGwRuptKKU0I8pLV6Jvs2m2WQBlKQrfSX9IIM4zqb0M+ST067huwRscJP/4bJJ2aPg+dQiGeR3VHLit/izMRzk/IjnT093i3qGlXDhdRZrxnlqd5flmSlnU5sBTfRr9wHcMdrxIXK3smhay/w8M7XeuIgpv9mUjizmg5e+bQkm4e8AZZxYasvUQAdLWWylcwMk9xPHYy9QGKRFTSl1weon6rRrXWVXP1b9PpR8PYeg1qPvV0k+QNKokDdveqzd2N6ZAilRqAMNVYYYnI1fgLTySfBdIXKMwZAM8OnQk0BBBfyPp+FkoB/zewC6pFy54w7gM2pjefdV3RWjOsc6ux/W6Ro2msZufDW1OzJU4Yj4uzWCtZdsjjkGcA2fB9cDQWlhhmkYVpc7tDfhQ2GFgRmTvuvCvZP2jfUbHcMTgK1CW0+zbX5gsGorWCrMvHL6boV3iRydndOvCFKBUFdDDPvKBjbRIJRuoNprpSmhjWwRYZdUUD+HU/S64vm4mKiWoLhP3hUeDHKSg26F7GomvEGoVz2MCkaqXteRUi9tAhNJIjy88a/l354IMWg=
63 changes: 46 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# sourced by https://github.com/octomation/makefiles

.DEFAULT_GOAL = test-with-coverage
GO_VERSIONS = 1.11 1.12 1.13 1.14
GIT_HOOKS = post-merge pre-commit pre-push
GO_VERSIONS = 1.13 1.14

SHELL := /bin/bash -euo pipefail # `explain set -euo pipefail`

Expand Down Expand Up @@ -55,19 +56,19 @@ deps-check:
deps-clean:
@go clean -modcache

.PHONY: deps-shake
deps-shake:
@go mod tidy
.PHONY: deps-fetch
deps-fetch:
@go mod download
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi

.PHONY: module-deps
module-deps:
@go mod download
.PHONY: deps-tidy
deps-tidy:
@go mod tidy
@if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi

.PHONY: update
update: selector = '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'
update:
.PHONY: deps-update
deps-update: selector = '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}'
deps-update:
@if command -v egg > /dev/null; then \
packages="`egg deps list`"; \
else \
Expand All @@ -80,17 +81,17 @@ update:
fi; \
if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi

.PHONY: update-all
update-all:
.PHONY: deps-update-all
deps-update-all:
@if [[ "`go version`" == *1.1[1-3]* ]]; then \
go get -d -mod= -u ./...; \
else \
go get -d -u ./...; \
fi; \
if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi

.PHONY: format
format:
.PHONY: go-fmt
go-fmt:
@if command -v goimports > /dev/null; then \
goimports -local $(LOCAL) -ungroup -w $(PATHS); \
else \
Expand All @@ -104,7 +105,7 @@ go-generate:
.PHONY: lint
lint:
@if command -v golangci-lint > /dev/null; then \
golangci-lint run ./...; \
`which time` -- golangci-lint run ./...; \
else \
go vet $(PACKAGES); \
fi
Expand Down Expand Up @@ -182,11 +183,30 @@ toolset:
@( \
GOFLAGS=$(TOOLFLAGS); \
cd tools; \
go mod tidy; \
go mod download; \
if [[ "`go env GOFLAGS`" =~ -mod=vendor ]]; then go mod vendor; fi; \
go generate tools.go; \
)

ifdef GIT_HOOKS

.PHONY: hooks
hooks:
@ls .git/hooks | grep -v .sample | sed 's|.*|.git/hooks/&|' | xargs rm -f || true
@for hook in $(GIT_HOOKS); do cp githooks/$$hook .git/hooks/; done

define hook_tpl
.PHONY: $(1)
$(1):
@githooks/$(1)
endef

render_hook_tpl = $(eval $(call hook_tpl,$(hook)))
$(foreach hook,$(GIT_HOOKS),$(render_hook_tpl))

endif

ifdef GO_VERSIONS

define go_tpl
Expand All @@ -205,17 +225,26 @@ $(foreach version,$(GO_VERSIONS),$(render_go_tpl))
endif


.PHONY: init
init: deps test lint hooks

.PHONY: clean
clean: build-clean deps-clean install-clean test-clean

.PHONY: deps
deps: module-deps toolset
deps: deps-fetch toolset

.PHONY: env
env: go-env build-env tools-env

.PHONY: format
format: go-fmt

.PHONY: generate
generate: go-generate format

.PHONY: refresh
refresh: deps-shake update deps generate format test build
refresh: deps-tidy update deps generate format test build

.PHONY: update
update: deps-update
Loading

0 comments on commit b05e22b

Please sign in to comment.