Skip to content

Commit 5ca8134

Browse files
Merge pull request #419 from spf13/ci
add github actions
2 parents d5e0c06 + 100ab0e commit 5ca8134

File tree

6 files changed

+82
-5
lines changed

6 files changed

+82
-5
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.go]
12+
indent_style = tab

.github/.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[{*.yml,*.yaml}]
2+
indent_size = 2

.github/dependabot.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: gomod
5+
directory: /
6+
schedule:
7+
interval: daily
8+
9+
- package-ecosystem: github-actions
10+
directory: /
11+
schedule:
12+
interval: daily

.github/workflows/ci.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
go: ["1.21", "1.22", "1.23"]
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
24+
with:
25+
go-version: ${{ matrix.go }}
26+
27+
- name: Test
28+
# Cannot enable shuffle for now because some tests rely on global state and order
29+
# run: go test -race -v -shuffle=on ./...
30+
run: go test -race -v ./...
31+
32+
lint:
33+
name: Lint
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
42+
with:
43+
go-version: "1.23"
44+
45+
- name: Lint
46+
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
47+
with:
48+
version: v1.63.4

.golangci.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
linters:
2+
disable-all: true
3+
enable:
4+
- nolintlint

flag_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ func testParseWithUnknownFlags(f *FlagSet, t *testing.T) {
433433
"-u=unknown3Value",
434434
"-p",
435435
"unknown4Value",
436-
"-q", //another unknown with bool value
436+
"-q", // another unknown with bool value
437437
"-y",
438438
"ee",
439439
"--unknown7=unknown7value",
@@ -899,7 +899,7 @@ func TestChangingArgs(t *testing.T) {
899899

900900
// Test that -help invokes the usage message and returns ErrHelp.
901901
func TestHelp(t *testing.T) {
902-
var helpCalled = false
902+
helpCalled := false
903903
fs := NewFlagSet("help test", ContinueOnError)
904904
fs.Usage = func() { helpCalled = true }
905905
var flag bool
@@ -998,6 +998,7 @@ func getDeprecatedFlagSet() *FlagSet {
998998
f.MarkDeprecated("badflag", "use --good-flag instead")
999999
return f
10001000
}
1001+
10011002
func TestDeprecatedFlagInDocs(t *testing.T) {
10021003
f := getDeprecatedFlagSet()
10031004

@@ -1134,7 +1135,6 @@ func TestMultipleNormalizeFlagNameInvocations(t *testing.T) {
11341135
}
11351136
}
11361137

1137-
//
11381138
func TestHiddenFlagInUsage(t *testing.T) {
11391139
f := NewFlagSet("bob", ContinueOnError)
11401140
f.Bool("secretFlag", true, "shhh")
@@ -1149,7 +1149,6 @@ func TestHiddenFlagInUsage(t *testing.T) {
11491149
}
11501150
}
11511151

1152-
//
11531152
func TestHiddenFlagUsage(t *testing.T) {
11541153
f := NewFlagSet("bob", ContinueOnError)
11551154
f.Bool("secretFlag", true, "shhh")
@@ -1239,7 +1238,7 @@ func TestPrintDefaults(t *testing.T) {
12391238
got := buf.String()
12401239
if got != defaultOutput {
12411240
fmt.Println("\n" + got)
1242-
fmt.Println("\n" + defaultOutput)
1241+
fmt.Printf("\n" + defaultOutput)
12431242
t.Errorf("got %q want %q\n", got, defaultOutput)
12441243
}
12451244
}

0 commit comments

Comments
 (0)