diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 1e18963..8e1fcd4 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -2,28 +2,35 @@ name: Test on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: - build: name: Test runs-on: ubuntu-latest steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.14 - id: go + - name: Get dependencies + run: go mod download - - name: Check out code into the Go module directory - uses: actions/checkout@v2 + - name: Test + run: go test -vet=off ./... - - name: Get dependencies - run: go mod download + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.30 - - name: Test - run: go test -vet=off ./... + - name: Check diffs + # --name-only first for debugging + run: git diff --name-only && git diff --quiet diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e37287d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + build: + name: Release + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..fc3a116 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,13 @@ +run: + deadline: 8m + build-tags: + - codeanalysis + +linters: + enable: + - gosec # (gas) Inspects source code for security problems + - nolintlint # Reports ill-formed or insufficient nolint directives + - unconvert # Remove unnecessary type conversions + - whitespace # Tool for detection of leading and trailing whitespace + - gofumpt # Gofumpt checks whether code was gofumpt-ed + - prealloc # Finds slice declarations that could potentially be preallocated diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..7b07b28 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,6 @@ +project_name: mylib-go +build: + skip: true +release: + github: + prerelease: auto diff --git a/example/nodes/math.go b/example/nodes/math.go index b92a320..27d13ae 100644 --- a/example/nodes/math.go +++ b/example/nodes/math.go @@ -15,7 +15,7 @@ func Adder(a, b int) (sum int) { return a + b } func Multiplier(a, b int) (product int) { return a * b } func RandomIntProducer() (n int) { - return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(100) + return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(100) //nolint:gosec // not really critical } // IntAggregator aggregates `list` using `reducer. diff --git a/wrappers/bind/graph/bind.go b/wrappers/bind/graph/bind.go index c1bb917..98d6c01 100644 --- a/wrappers/bind/graph/bind.go +++ b/wrappers/bind/graph/bind.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/constants/graph/constants.go b/wrappers/constants/graph/constants.go index e6e8545..e3b4af3 100644 --- a/wrappers/constants/graph/constants.go +++ b/wrappers/constants/graph/constants.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/ctx/graph/ctx.go b/wrappers/ctx/graph/ctx.go index fea30f1..e418732 100644 --- a/wrappers/ctx/graph/ctx.go +++ b/wrappers/ctx/graph/ctx.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/gonodes/graph/gonodes.go b/wrappers/gonodes/graph/gonodes.go index b0cc3da..4cd50bf 100644 --- a/wrappers/gonodes/graph/gonodes.go +++ b/wrappers/gonodes/graph/gonodes.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/ifs/graph/ifs.go b/wrappers/ifs/graph/ifs.go index 4b24a5c..ca5d156 100644 --- a/wrappers/ifs/graph/ifs.go +++ b/wrappers/ifs/graph/ifs.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/inputs/graph/inputs.go b/wrappers/inputs/graph/inputs.go index 0c0bb7b..fd2f045 100644 --- a/wrappers/inputs/graph/inputs.go +++ b/wrappers/inputs/graph/inputs.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/mockingjay/graph/mockingjay.go b/wrappers/mockingjay/graph/mockingjay.go index a42e8a1..53b710c 100644 --- a/wrappers/mockingjay/graph/mockingjay.go +++ b/wrappers/mockingjay/graph/mockingjay.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/outputs/graph/outputs.go b/wrappers/outputs/graph/outputs.go index d67052d..6575f11 100644 --- a/wrappers/outputs/graph/outputs.go +++ b/wrappers/outputs/graph/outputs.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis diff --git a/wrappers/types/graph/types.go b/wrappers/types/graph/types.go index b74c3c0..e93bf6e 100644 --- a/wrappers/types/graph/types.go +++ b/wrappers/types/graph/types.go @@ -1,4 +1,4 @@ -// Code generated by lib-go/goflow DO NOT EDIT. +// Code generated by goflow DO NOT EDIT. // +build !codeanalysis