Skip to content

Commit

Permalink
upgrade golang version (#7)
Browse files Browse the repository at this point in the history
* upgrade golang version

* upgrade golang ci

* upgrade other actions

* fix test

* gofmt

* upgrade golangci

* change golang version

* set label strings in message label test
  • Loading branch information
mfleader authored Jan 30, 2024
1 parent f9eb8ed commit c29ae4d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
# Hard-coding version due to this bug: https://github.com/golangci/golangci-lint-action/issues/535
version: v1.47
version: v1.55.2
test:
name: go test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.21.6
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
Expand All @@ -50,7 +49,7 @@ jobs:
go tool cover -func /tmp/coverage.out
echo "::endgroup::"
- name: Upload test log
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
Expand All @@ -64,12 +63,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.18
- uses: actions/cache@v2
go-version: 1.21.6
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.arcalot.io/log/v2

go 1.18
go 1.21
13 changes: 8 additions & 5 deletions message_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ import (

func TestMessageLabels(t *testing.T) {
var l log.Labels = map[string]string{}
labelStrEmpty := l.String()
if l.String() != "" {
t.Fatalf("Incorrect label string: %s", l.String())
t.Fatalf("Incorrect label string: %s", labelStrEmpty)
}
l = map[string]string{"foo": "bar"}
if l.String() != "foo=bar" {
t.Fatalf("Incorrect label string: %s", l.String())
labelStr1Key := l.String()
if labelStr1Key != "foo=bar" {
t.Fatalf("Incorrect label string: %s", labelStr1Key)
}
l = map[string]string{"foo": "bar", "baz": "Hello world!"}
if l.String() != "foo=bar;baz=Hello world!" && l.String() != "baz=Hello world!;foo=bar" {
t.Fatalf("Incorrect label string: %s", l.String())
labelStr2Keys := l.String()
if labelStr2Keys != "foo=bar;baz=Hello world!" && labelStr2Keys != "baz=Hello world!;foo=bar" {
t.Fatalf("Incorrect label string 3: %s", labelStr2Keys)
}
}

0 comments on commit c29ae4d

Please sign in to comment.