Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Oct 8, 2024
1 parent c8156c2 commit 813b28c
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 1,224 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,38 @@ on:
workflow_call:
push:
branches:
- main
- release/*
- main
- release/*
pull_request:
branches:
- main
- main

jobs:
test:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: make test
- uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Go Test Results
path: .test/reports/**-test.xml
reporter: java-junit
fail-on-error: 'true'
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test Reports
path: .test/reports/**
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache-dependency-path: |
tools/go.sum
go.sum
- run: make test
- uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Go Test Results
path: .test/reports/**-test.xml
reporter: java-junit
fail-on-error: "true"
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test Reports
path: .test/reports/**

lint:
runs-on: ubuntu-latest
Expand All @@ -44,4 +47,4 @@ jobs:
with:
go-version-file: ./go.mod
check-latest: true
- run: make lint
- run: make lint
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
permissions:
Expand All @@ -18,11 +18,14 @@ jobs:

release:
runs-on: ubuntu-latest
needs: [ test ]
needs: [test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
cache-dependency-path: |
tools/go.sum
go.sum
- run: make release
if: success()
if: success()
64 changes: 30 additions & 34 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
run:
deadline: 6m

skip-files:
- "zz_generated\\..+\\.go$"

skip-dirs:
- vendor$
timeout: 6m

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
formats:
- format: colored-line-number

linters-settings:
errcheck:
Expand All @@ -21,19 +16,15 @@ linters-settings:
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.*
# report about not checking of errors in assignments: `num, err := strconv.Atoi(numStr)`;
exclude-functions:
- fmt:.*
- io/ioutil:^Read.*

govet:
# report about shadowed variables
check-shadowing: false

golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8

gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
Expand All @@ -47,10 +38,6 @@ linters-settings:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10

maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true

dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
Expand Down Expand Up @@ -109,35 +96,39 @@ linters-settings:
severity: warning
confidence: 0.8


linters:
enable:
- megacheck
- govet
- gocyclo
- gocritic
- gosimple
- staticcheck
- unused
- goconst
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- revive
- unconvert
- misspell
- nakedret
- exportloopref
- copyloopvar
- gosec

disable:
- scopelint
- errcheck

presets:
- bugs
- unused
fast: false


issues:
exclude-files:
- "zz_generated\\..+\\.go$"
exclude-dirs:
- vendor$

exclude:
- "G103: Use of unsafe calls should be audited"

Expand All @@ -164,31 +155,36 @@ issues:
# rather than using a pointer.
- text: "(hugeParam|rangeValCopy):"
linters:
- gocritic
- gocritic

# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- text: "SA3000:"
linters:
- staticcheck
- staticcheck

- text: "k8s.io/api/core/v1"
linters:
- goimports
- goimports

# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- text: "G101:"
linters:
- gosec
- gas
- gosec
- gas

# This is an 'errors unhandled' warning that duplicates errcheck.
- text: "G104:"
linters:
- gosec
- gas
- gosec
- gas

- text: "G115:"
linters:
- gosec
- gas

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
Expand All @@ -208,4 +204,4 @@ issues:
max-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
max-same-issues: 0
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ builds:
release:
header: |
## Changelog ({{ .Date }})
Welcome to this new release! We hope you enjoy the changes we've made.
changelog:
groups:
Expand All @@ -23,4 +23,4 @@ changelog:
exclude:
- "^docs:"
- typo
- (?i)foo
- (?i)foo
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
.DEFAULT_GOAL := build

GO ?= go
GO_RUN_TOOLS ?= $(GO) run -modfile ./tools/go.mod
GO_TEST ?= $(GO_RUN_TOOLS) gotest.tools/gotestsum --format pkgname
GO_RELEASER ?= $(GO_RUN_TOOLS) github.com/goreleaser/goreleaser
GO_MOD ?= $(shell ${GO} list -m)
GO ?= go
GO_RUN_TOOLS ?= $(GO) run -modfile ./tools/go.mod
GO_TEST ?= $(GO_RUN_TOOLS) gotest.tools/gotestsum --format pkgname
GO_RELEASER ?= $(GO_RUN_TOOLS) github.com/goreleaser/goreleaser
GO_MOD ?= $(shell ${GO} list -m)

# Module name
MODULE_NAME ?= github.com/katallaxie/template-go

.PHONY: release
release: ## Release the project.
$(GO_RELEASER) release --clean

.PHONY: build
build: ## Build the binary file.
$(GO_RELEASER) build --snapshot --clean
Expand Down Expand Up @@ -42,4 +46,4 @@ clean: ## Remove previous build.

.PHONY: help
help: ## Display this help screen.
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ make help

Other available targets are

* `build`
* `fmt`
* `lint`
* `vet`
* `generate`
* `clean`
```bash
build Build the binary file.
clean Remove previous build.
fmt Run go fmt against code.
generate Generate code.
help Display this help screen.
lint Run lint.
release Release the project.
test Run tests.
vet Run go vet against code.
```

The convention is to use `make` to run the build.

Expand Down
Loading

0 comments on commit 813b28c

Please sign in to comment.