Skip to content

Commit 7135260

Browse files
golang-lint update
1 parent 8413a3d commit 7135260

File tree

4 files changed

+44
-14
lines changed

4 files changed

+44
-14
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,41 @@ on:
44
tags:
55
- v*
66
branches:
7+
- master
78
- main
89
pull_request:
910
permissions:
1011
contents: read
1112
# Optional: allow read access to pull request. Use with `only-new-issues` option.
12-
# pull-requests: read
13+
pull-requests: read
1314
jobs:
1415
golangci:
1516
name: lint
1617
runs-on: ubuntu-latest
1718
steps:
18-
- uses: actions/checkout@v2
19+
- uses: actions/setup-go@v4
20+
with:
21+
go-version: '1.17'
22+
cache: false
23+
- uses: actions/checkout@v3
1924
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v2
25+
uses: golangci/golangci-lint-action@v3
2126
with:
2227
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
23-
version: latest
28+
version: v1.29
2429

2530
# Optional: working directory, useful for monorepos
2631
# working-directory: somedir
2732

2833
# Optional: golangci-lint command line arguments.
29-
# args: -E gosec -E megacheck -E govet -E goconst -E lll -E gocritic -E gocyclo -E godox -E dupl -E depguard
34+
# args: --issues-exit-code=0
3035

3136
# Optional: show only new issues if it's a pull request. The default value is `false`.
3237
# only-new-issues: true
3338

34-
# Optional: if set to true then the action will use pre-installed Go.
35-
# skip-go-installation: true
39+
# Optional: if set to true then the all caching functionality will be complete disabled,
40+
# takes precedence over all other caching options.
41+
# skip-cache: true
3642

3743
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
3844
# skip-pkg-cache: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14-
# Dependency directories (remove the comment below to include it)
14+
# Directories (remove the comment below to include it)
1515
# vendor/
16+
out/
17+
bin/

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
GOTEST=go test
3+
BINARY_NAME=goframe
4+
5+
.PHONY: test build run clean go-lint
6+
7+
build: ## Build project and put the output binary in bin/
8+
mkdir -p bin/
9+
GO111MODULE=on go build -o bin/$(BINARY_NAME) .
10+
11+
clean: ## Remove build related file
12+
rm -fr ./bin
13+
14+
run: build
15+
./bin/$(BINARY_NAME)
16+
17+
## Test:
18+
test:
19+
$(GOTEST) -cover -v -race ./...
20+
21+
go-lint:
22+
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.52.2 golangci-lint run -v

app.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ func (a *app) SetInCtx(key string, value interface{}) {
4646
// In production configs can be stored as env vars.
4747
//
4848
// Defaults:
49-
// * The default config reader expects the config files
50-
// to be kept inside configs/ dir in app root dir.
51-
// * The name of the app would be the default expected config file name.
52-
// * While using env vars, `_` would be the default separator.
53-
// * The env vars would have the app name as a default prefix.
54-
// * eg. for app name "simple" -> simple_server_host
49+
// - The default config reader expects the config files
50+
// to be kept inside configs/ dir in app root dir.
51+
// - The name of the app would be the default expected config file name.
52+
// - While using env vars, `_` would be the default separator.
53+
// - The env vars would have the app name as a default prefix.
54+
// - eg. for app name "simple" -> simple_server_host
5555
func (a *app) Config() Config { return a.config }
5656

5757
// NewApp returns an instance of app.

0 commit comments

Comments
 (0)