Skip to content

Commit

Permalink
Bump to Go 1.22 (#44)
Browse files Browse the repository at this point in the history
Also cleanup old links
  • Loading branch information
sethvargo committed Mar 25, 2024
1 parent e3fb1a5 commit 1f4abbb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 56 deletions.
74 changes: 29 additions & 45 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,43 @@
name: Test
name: 'Test'

on:
push:
branches:
- main
- 'main'
tags:
- '*'
- '*'
pull_request:
branches:
- main
- 'main'

jobs:
# unit runs the unit tests
unit:
strategy:
fail-fast: false
matrix:
go:
- '1.14'
- '1.15'
- '1.16'
- '1.17'
os:
- 'macos-latest'
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
- 'ubuntu-latest'
- 'windows-latest'

runs-on: ${{ matrix.os }}
runs-on: '${{ matrix.os }}'

steps:
- uses: actions/checkout@v2
- uses: 'actions/checkout@v4'

- uses: actions/setup-go@v2
- uses: 'actions/setup-go@v5'
with:
go-version: ${{ matrix.go }}

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: 'go.mod'

- name: Lint
run: make fmtcheck staticcheck spellcheck
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.16' }}
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |-
make fmtcheck staticcheck spellcheck
- name: Test
run: make test
run: |-
make test-acc
# build runs go build on the target platforms to ensure the runtime links are
# correct.
Expand All @@ -56,34 +46,28 @@ jobs:
fail-fast: false
matrix:
goos:
- 'darwin'
- 'freebsd'
- 'linux'
- 'netbsd'
- 'openbsd'
- 'solaris'
- 'windows'
- 'darwin'
- 'freebsd'
- 'linux'
- 'netbsd'
- 'openbsd'
- 'solaris'
- 'windows'
goarch:
- 'amd64'
- 'amd64'

runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: '1.16'
- uses: 'actions/checkout@v4'

- uses: actions/cache@v2
- uses: 'actions/setup-go@v5'
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: 'go.mod'

- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build ./...
run: |-
go build -a ./...
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
VETTERS = "asmdecl,assign,atomic,bools,buildtag,cgocall,composites,copylocks,errorsas,httpresponse,loopclosure,lostcancel,nilfunc,printf,shift,stdmethods,structtag,tests,unmarshal,unreachable,unsafeptr,unusedresult"
GOFMT_FILES = $(shell go list -f '{{.Dir}}' ./...)

benchmarks:
@(cd benchmarks/ && go test -bench=. -benchmem -benchtime=1s ./...)
.PHONY: benchmarks

fmtcheck:
@command -v goimports > /dev/null 2>&1 || (cd tools/ && go get golang.org/x/tools/cmd/goimports)
@command -v goimports > /dev/null 2>&1 || (cd tools/ && go install golang.org/x/tools/cmd/goimports@latest)
@CHANGES="$$(goimports -d $(GOFMT_FILES))"; \
if [ -n "$${CHANGES}" ]; then \
echo "Unformatted (run goimports -w .):\n\n$${CHANGES}\n\n"; \
Expand All @@ -21,29 +20,31 @@ fmtcheck:
.PHONY: fmtcheck

spellcheck:
@command -v misspell > /dev/null 2>&1 || (cd tools/ && go get github.com/client9/misspell/cmd/misspell)
@command -v misspell > /dev/null 2>&1 || (cd tools/ && go install github.com/client9/misspell/cmd/misspell@latest)
@misspell -locale="US" -error -source="text" **/*
.PHONY: spellcheck

staticcheck:
@command -v staticcheck > /dev/null 2>&1 || (cd tools/ && go get honnef.co/go/tools/cmd/staticcheck)
@command -v staticcheck > /dev/null 2>&1 || (cd tools/ && go install honnef.co/go/tools/cmd/staticcheck@latest)
@staticcheck -checks="all" -tests $(GOFMT_FILES)
.PHONY: staticcheck

test:
@go test \
-count=1 \
-shuffle=on \
-short \
-timeout=5m \
-vet="${VETTERS}" \
-vet=all \
./...
.PHONY: test

test-acc:
@go test \
-count=1 \
-shuffle=on \
-race \
-timeout=10m \
-vet="${VETTERS}" \
-vet=all \
./...
.PHONY: test-acc
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Go Rate Limiter

[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/mod/github.com/sethvargo/go-limiter)
[![GitHub Actions](https://img.shields.io/github/workflow/status/sethvargo/go-limiter/Test?style=flat-square)](https://github.com/sethvargo/go-limiter/actions?query=workflow%3ATest)
[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/sethvargo/go-limiter)
[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/sethvargo/go-limiter/test.yml?style=flat-square)](https://github.com/sethvargo/go-limiter/actions/workflows/test.yml)


This package provides a rate limiter in Go (Golang), suitable for use in HTTP
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/sethvargo/go-limiter

go 1.14
go 1.22

toolchain go1.22.1
1 change: 0 additions & 1 deletion internal/fasttime/fasttime.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !windows
// +build !windows

// Package fasttime gets wallclock time, but super fast.
package fasttime
Expand Down
2 changes: 1 addition & 1 deletion internal/fasttime/fasttime_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build windows
//go:build windows

package fasttime

Expand Down

0 comments on commit 1f4abbb

Please sign in to comment.