Skip to content

Commit d5d251f

Browse files
authoredAug 22, 2021
Merge pull request #15 from spiegel-im-spiegel/refactoring-and-testing
Fix warning of lint S1017
2 parents b314f1f + 8d25ab0 commit d5d251f

File tree

9 files changed

+41
-42
lines changed

9 files changed

+41
-42
lines changed
 

‎.github/workflows/codeql-analysis.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,13 @@ jobs:
3636
# a pull request then we can checkout the head.
3737
fetch-depth: 2
3838

39-
# If this run was triggered by a pull request event, then checkout
40-
# the head of the pull request instead of the merge commit.
41-
- run: git checkout HEAD^2
42-
if: ${{ github.event_name == 'pull_request' }}
43-
4439
# Initializes the CodeQL tools for scanning.
4540
- name: Initialize CodeQL
4641
uses: github/codeql-action/init@v1
4742
with:
4843
languages: ${{ matrix.language }}
4944
# If you wish to specify custom queries, you can do so here or in a config file.
50-
# By default, queries listed here will override any specified in a config file.
45+
# By default, queries listed here will override any specified in a config file.
5146
# Prefix the list here with "+" to use these queries and those in the config file.
5247
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5348

‎.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-go@v2
1414
with:
15-
go-version: ^1.16
15+
go-version: ^1.17
1616
- name: golangci-lint
1717
uses: golangci/golangci-lint-action@v2
1818
with:
@@ -21,4 +21,4 @@ jobs:
2121
# Optional: golangci-lint command line arguments.
2222
args: --enable gosec
2323
- name: testing
24-
run: go test ./...
24+
run: go test -shuffle on ./...

‎.github/workflows/vulns.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-go@v2
1414
with:
15-
go-version: ^1.16
15+
go-version: ^1.17
1616
- name: WriteGoList
1717
run: go list -json -m all > go.list
1818
- name: Nancy

‎.gitignore

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2-
*.o
3-
*.a
4-
*.so
1+
# Binaries for programs and plugins
52
*.exe
6-
*.test
7-
*.prof
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
87

9-
# Folders
10-
_obj
11-
_test
12-
vendor/
8+
# Test binary, built with `go test -c`
9+
*.test
1310

14-
# Architecture specific extensions/prefixes
15-
*.[568vq]
16-
[568vq].out
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
1713

18-
*.cgo1.go
19-
*.cgo2.c
20-
_cgo_defun.c
21-
_cgo_gotypes.go
22-
_cgo_export.*
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
2316

24-
_testmain.go
17+
# Other directories and files
18+
.task/

‎Taskfile.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3'
2+
3+
tasks:
4+
default:
5+
cmds:
6+
- task: clean
7+
- task: test
8+
9+
test:
10+
desc: Test and lint.
11+
cmds:
12+
- go mod verify
13+
- go test -shuffle on ./...
14+
- docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.42.0 golangci-lint run --enable gosec --timeout 3m0s ./...
15+
sources:
16+
- ./go.mod
17+
- '**/*.go'
18+
19+
clean:
20+
desc: Initialize module and build cache, and remake go.sum file.
21+
cmds:
22+
- go mod tidy -v -go=1.17

‎clean-all.sh

-4
This file was deleted.

‎file/glob.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ func getRoots(rootDir string) []string {
145145
if len(rootDir) == 0 {
146146
return []string{""}
147147
}
148-
if strings.HasSuffix(rootDir, "/") {
149-
rootDir = rootDir[:len(rootDir)-1]
150-
}
148+
rootDir = strings.TrimSuffix(rootDir, "/")
151149
roots := []string{}
152150
if paths, err := filepath.Glob(rootDir); err == nil {
153151
for _, path := range paths {

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/spiegel-im-spiegel/gocli
22

3-
go 1.16
3+
go 1.17

‎test-all.sh

-6
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.