Skip to content

Commit

Permalink
Use Go 1.22 (#2)
Browse files Browse the repository at this point in the history
Use Go 1.22 and add GitHub action
  • Loading branch information
esimonov authored Mar 1, 2024
1 parent a27d866 commit 18daecf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Go

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"

- name: Test
run: |
go install gotest.tools/gotestsum@latest
gotestsum --junitfile test-reports/junit.xml -- -timeout 1m -count=1 -coverprofile=cp.out -race -v ./...
- name: Test Summary
uses: test-summary/action@v2
with:
paths: test-reports/junit.xml
if: always()
12 changes: 6 additions & 6 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ func init() {
func TestLoadLocation_SafeForConcurrentAccess(t *testing.T) {
wg := new(sync.WaitGroup)

for i := 0; i < 100; i++ {
for range 100 {
for _, locName := range testLocNames {
wg.Add(1)

go func(name string) {
go func() {
defer wg.Done()

if _, err := locache.LoadLocation(name); err != nil {
if _, err := locache.LoadLocation(locName); err != nil {
panic(err)
}
}(locName)
}()
}
}

Expand Down Expand Up @@ -99,7 +99,7 @@ func loadIANATzNamesFromZip(zipfile string) []string {

ianaNames := make([]string, n)

for i := 0; i < n; i++ {
for i := range n {
getn(4, buf)

namelen := getn(2, buf[28:])
Expand Down Expand Up @@ -136,7 +136,7 @@ func getn(n int, b []byte) (result int) {
return 0
}

for i := 0; i < n; i++ {
for i := range n {
result |= int(b[i]) << (i * 8)
}
return result
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 github.com/esimonov/locache

go 1.21
go 1.22

0 comments on commit 18daecf

Please sign in to comment.