Skip to content

Commit

Permalink
target only upstream supported versions of Go (#159)
Browse files Browse the repository at this point in the history
As per the [Golang release
policy](https://go.dev/doc/devel/release#policy):

>Each major Go release is supported until there are two newer major
releases.

`gostats` doesn't need to support `1.17` or `1.18` anymore, so:

- Change unit test suite to target currently supported versions of Go.
- Change the `go.mod` version to be `1.18` to mark that we will need
generics support in #158.

Also going through and fixing lint errors with 325decb so that this PR
can be merged.
  • Loading branch information
crockeo authored Jun 21, 2023
1 parent 911c76a commit e6b88e6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ jobs:
strategy:
matrix:
go-version:
- 1.17.x
- 1.18.x
- 1.19.x
- 1.20.x

name: run-tests
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
linters:
disable-all: true
enable:
- depguard
- gofumpt
- goimports
- gosimple
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/lyft/gostats

go 1.17
go 1.18

require github.com/kelseyhightower/envconfig v1.4.0
2 changes: 1 addition & 1 deletion mock/sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func TestSink_ThreadSafe(t *testing.T) {
sink.AssertGaugeEquals(t, "name", uint64(1))
}

func TestSink_ThreadSafe_Reset(t *testing.T) {
func TestSink_ThreadSafe_Reset(_ *testing.T) {
const N = 2000
sink := mock.NewSink()
funcs := [...]func(){
Expand Down
2 changes: 1 addition & 1 deletion mock_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (m *MockSink) FlushGauge(name string, value uint64) {
}

// FlushTimer satisfies the Sink interface.
func (m *MockSink) FlushTimer(name string, value float64) {
func (m *MockSink) FlushTimer(name string, value float64) { //nolint:revive
m.tLock.Lock()
defer m.tLock.Unlock()
m.Timers[name]++
Expand Down
6 changes: 3 additions & 3 deletions null_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ func NewNullSink() FlushableSink {
return nullSink{}
}

func (s nullSink) FlushCounter(name string, value uint64) {}
func (s nullSink) FlushCounter(name string, value uint64) {} //nolint:revive

func (s nullSink) FlushGauge(name string, value uint64) {}
func (s nullSink) FlushGauge(name string, value uint64) {} //nolint:revive

func (s nullSink) FlushTimer(name string, value float64) {}
func (s nullSink) FlushTimer(name string, value float64) {} //nolint:revive

func (s nullSink) Flush() {}
4 changes: 2 additions & 2 deletions stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

// Ensure flushing and adding generators does not race
func TestStats(t *testing.T) {
func TestStats(_ *testing.T) {
sink := &testStatSink{}
store := NewStore(sink, true)

Expand Down Expand Up @@ -46,7 +46,7 @@ func TestStats(t *testing.T) {

// TestStatsStartContext ensures that a cancelled context cancels a
// flushing goroutine.
func TestStatsStartContext(t *testing.T) {
func TestStatsStartContext(_ *testing.T) {
sink := &testStatSink{}
store := NewStore(sink, true)

Expand Down

0 comments on commit e6b88e6

Please sign in to comment.