Skip to content

Commit

Permalink
bump go, add comments to CI workflows, update golangci lint, fix lint…
Browse files Browse the repository at this point in the history
…er errors
  • Loading branch information
HarrisonWAffel committed Oct 3, 2024
1 parent 9e6bcb6 commit 49f6756
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/PR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: golangci/[email protected]
with:
args: --timeout=10m
version: v1.59
version: v1.60

test:
strategy:
Expand All @@ -31,6 +31,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# This step is required otherwise the 'mage'
# command cannot be used in subsequent steps
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -39,7 +41,7 @@ jobs:
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
- name: Run E2E tests
shell: pwsh
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# This step is required otherwise the 'mage'
# command cannot be used in subsequent steps
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -28,7 +30,7 @@ jobs:
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
- name: Run E2E tests
shell: pwsh
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
- name: build-binary
run: |
Expand Down Expand Up @@ -82,6 +82,8 @@ jobs:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

# This step is required otherwise the 'mage'
# command cannot be used in subsequent steps
- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -90,7 +92,7 @@ jobs:
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
- name: build-binary
run: |
Expand Down Expand Up @@ -126,7 +128,7 @@ jobs:
- name: Install Dependencies
run: |
go install github.com/magefile/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
- name: build-binary
run: |
Expand Down
3 changes: 2 additions & 1 deletion .golangci.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"tests",
"scripts",
"charts",
"package"
"package",
"pkg/powershell/powershell.go"
]
}
}
8 changes: 4 additions & 4 deletions pkg/converters/byte_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
func TestUnsafeStringToBytes(t *testing.T) {
want := "hello world"
got := string(UnsafeStringToBytes("hello world"))
if string(got) != string(want) {
if got != want {
t.Errorf("error, should be %s, but got %s", want, got)
}
}

func TestUnsafeBytesToString(t *testing.T) {
want := "hello world"
got := UnsafeBytesToString([]byte("hello world"))
if string(got) != string(want) {
if got != want {
t.Errorf("error, should be %s, but got %s", want, got)
}
}
Expand All @@ -30,7 +30,7 @@ func TestUnsafeUTF16BytesToString(t *testing.T) {
'l',
'o',
0x00})
if string(got) != string(want) {
t.Errorf("error, should be " + want + ", but got " + got)
if got != want {
t.Errorf("error, should be %s, but got %s", want, got)
}
}
8 changes: 4 additions & 4 deletions pkg/converters/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ func TestToJson(t *testing.T) {

got, err := ToJSON(json)
if err != nil {
t.Errorf("error occurred, " + err.Error())
t.Errorf("error occurred, %v", err)
}

if got != want {
t.Errorf("error, should be " + want + ", but got " + got)
t.Errorf("error, should be %s, but got %s", want, got)
}
}

Expand All @@ -43,10 +43,10 @@ func TestToYaml(t *testing.T) {

got, err := ToYaml(yaml)
if err != nil {
t.Errorf("error occurred, " + err.Error())
t.Errorf("error occurred, %v", err)
}

if strings.TrimSpace(got) != want {
t.Errorf("error, should be " + want + ", but got " + got)
t.Errorf("error, should be %s, but got %s", want, got)
}
}
4 changes: 2 additions & 2 deletions pkg/npipes/npipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func TestCreatePipe(t *testing.T) {
_, err := New(tt.args.name, tt.args.sddl, tt.args.bufferSize)
if err != nil {
if !tt.error {
t.Errorf("error occurred, " + err.Error())
t.Errorf("error occurred, %v", err)
}
if !strings.Contains(err.Error(), tt.want) {
t.Errorf("error, should be " + tt.want + ", but got " + err.Error())
t.Errorf("error, should be %s, but got %s", tt.want, err.Error())
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions suc/pkg/service/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ func ConfigureDelayedStart() error {
return fmt.Errorf("failed to update %s service configuration while configuring service start type: %w", defaults.WindowsServiceName, err)
}
return nil
} else {
logrus.Infof("%s delayed start already set to %t", defaults.WindowsServiceName, delayedStart)
}

logrus.Infof("%s delayed start already set to %t", defaults.WindowsServiceName, delayedStart)

return nil
}

Expand Down

0 comments on commit 49f6756

Please sign in to comment.