Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing support for Go 1.21 #4233

Merged
merged 3 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
# backwards compatibility with the previous two minor releases and we
# explicitly test our code for these versions so keeping this at prior
# versions does not add value.
DEFAULT_GO_VERSION: "1.20"
DEFAULT_GO_VERSION: "1.21"
jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
compatibility-test:
strategy:
matrix:
go-version: ["1.20", 1.19]
go-version: ["1.21", "1.20", 1.19]
os: [ubuntu-latest, macos-latest, windows-latest]
# GitHub Actions does not support arm* architectures on default
# runners. It is possible to acomplish this with a self-hosted runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-dependabot-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21'

- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-go@v4
with:
go-version: '^1.20.0'
go-version: '^1.21.0'
- uses: evantorrie/mott-the-tidier@v1-beta
id: modtidy
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- The `go.opentelemetry.io/contrib/exporters/autoexport` package to provide configuration of trace exporters with useful defaults and envar support. (#2753, #4100, #4129, #4132, #4134)
- `WithRouteTag` in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` adds HTTP route attribute to metrics. (#615)
- Add `WithSpanOptions` option in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#3768)
- Add testing support for Go 1.21. (#4233)

### Fixed

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ This project is tested on the following systems.

| OS | Go Version | Architecture |
| ------- | ---------- | ------------ |
| Ubuntu | 1.21 | amd64 |
| Ubuntu | 1.20 | amd64 |
| Ubuntu | 1.19 | amd64 |
| Ubuntu | 1.21 | 386 |
| Ubuntu | 1.20 | 386 |
| Ubuntu | 1.19 | 386 |
| MacOS | 1.21 | amd64 |
| MacOS | 1.20 | amd64 |
| MacOS | 1.19 | amd64 |
| Windows | 1.21 | amd64 |
| Windows | 1.20 | amd64 |
| Windows | 1.19 | amd64 |
| Windows | 1.21 | 386 |
| Windows | 1.20 | 386 |
| Windows | 1.19 | 386 |

Expand Down
4 changes: 3 additions & 1 deletion samplers/aws/xray/remote_sampler_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func WithLogger(l logr.Logger) Option {
})
}

var defaultLogger = stdr.NewWithOptions(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile), stdr.Options{LogCaller: stdr.Error})

func newConfig(opts ...Option) (*config, error) {
defaultProxyEndpoint, err := url.Parse("http://127.0.0.1:2000")
if err != nil {
Expand All @@ -83,7 +85,7 @@ func newConfig(opts ...Option) (*config, error) {
cfg := &config{
endpoint: *defaultProxyEndpoint,
samplingRulesPollingInterval: defaultPollingInterval * time.Second,
logger: stdr.NewWithOptions(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile), stdr.Options{LogCaller: stdr.Error}),
logger: defaultLogger,
}

for _, option := range opts {
Expand Down
7 changes: 2 additions & 5 deletions samplers/aws/xray/remote_sampler_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
package xray

import (
"log"
"net/url"
"os"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/go-logr/logr"
"github.com/go-logr/stdr"
"github.com/stretchr/testify/assert"
)

Expand All @@ -51,7 +48,7 @@ func TestDefaultConfig(t *testing.T) {

assert.Equal(t, cfg.samplingRulesPollingInterval, 300*time.Second)
assert.Equal(t, cfg.endpoint, *endpoint)
assert.Equal(t, cfg.logger, stdr.NewWithOptions(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile), stdr.Options{LogCaller: stdr.Error}))
assert.Equal(t, cfg.logger, defaultLogger)
}

// assert when some config is provided by user then other config will be picked up from default config.
Expand All @@ -64,7 +61,7 @@ func TestPartialUserProvidedConfig(t *testing.T) {

assert.Equal(t, cfg.samplingRulesPollingInterval, 500*time.Second)
assert.Equal(t, cfg.endpoint, *endpoint)
assert.Equal(t, cfg.logger, stdr.NewWithOptions(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile), stdr.Options{LogCaller: stdr.Error}))
assert.Equal(t, cfg.logger, defaultLogger)
}

// assert that valid endpoint would not result in an error.
Expand Down