mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-10 09:50:58 +02:00
Bump CI default version of Go to 1.20 (#3733)
* Bump CI default version of Go to 1.20 * Use crypto/rand in Jaeger exporter testing * Use crypto/rand Reader in otlp exporters * Remove use of dep rand.Seed in prometheus exporter * Update changelog with public changes * Quote DEFAULT_GO_VERSION value * Update .github/workflows/ci.yml * Update CHANGELOG.md Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Damien Mathieu <42@dmathieu.com>
This commit is contained in:
parent
d68b05fbee
commit
80f187fd0d
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -7,8 +7,14 @@ on:
|
||||
env:
|
||||
# Path to where test results will be saved.
|
||||
TEST_RESULTS: /tmp/test-results
|
||||
# Default minimum version of Go to support.
|
||||
DEFAULT_GO_VERSION: 1.19
|
||||
# Default version of Go to use by CI workflows. This should be the latest
|
||||
# release of Go; developers likely use the latest release in development and
|
||||
# we want to catch any bugs (e.g. lint errors, race detection) with this
|
||||
# release before they are merged. The Go compatibility guarantees ensure
|
||||
# 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"
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -38,6 +38,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
### Fixed
|
||||
|
||||
- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725)
|
||||
- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733)
|
||||
|
||||
## [1.13.0/0.36.0] 2023-02-07
|
||||
|
||||
|
@ -33,11 +33,8 @@ import (
|
||||
"go.opentelemetry.io/otel/sdk/metric"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
func main() {
|
||||
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
ctx := context.Background()
|
||||
|
||||
// The exporter embeds a default OpenTelemetry Reader and
|
||||
@ -70,7 +67,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
_, err = meter.RegisterCallback(func(_ context.Context, o api.Observer) error {
|
||||
n := -10. + rand.Float64()*(90.) // [-10, 100)
|
||||
n := -10. + rng.Float64()*(90.) // [-10, 100)
|
||||
o.ObserveFloat64(gauge, n, attrs...)
|
||||
return nil
|
||||
}, gauge)
|
||||
|
@ -16,8 +16,8 @@ package jaeger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
cryptorand "crypto/rand"
|
||||
"crypto/rand"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix" // nolint:depguard // This is for testing.
|
||||
@ -29,7 +29,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
mathrand "math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -389,25 +388,17 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) {
|
||||
}
|
||||
}
|
||||
|
||||
type mathRandReader struct{}
|
||||
|
||||
func (mathRandReader) Read(p []byte) (n int, err error) {
|
||||
return mathrand.Read(p)
|
||||
}
|
||||
|
||||
var randReader mathRandReader
|
||||
|
||||
// Based on https://golang.org/src/crypto/tls/generate_cert.go,
|
||||
// simplified and weakened.
|
||||
func weakCertificate() (tls.Certificate, error) {
|
||||
priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader)
|
||||
priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
notBefore := time.Now()
|
||||
notAfter := notBefore.Add(time.Hour)
|
||||
max := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||
sn, err := cryptorand.Int(randReader, max)
|
||||
sn, err := rand.Int(rand.Reader, max)
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
@ -422,7 +413,7 @@ func weakCertificate() (tls.Certificate, error) {
|
||||
DNSNames: []string{"localhost"},
|
||||
IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)},
|
||||
}
|
||||
derBytes, err := x509.CreateCertificate(randReader, &tmpl, &tmpl, &priv.PublicKey, priv)
|
||||
derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv)
|
||||
if err != nil {
|
||||
return tls.Certificate{}, err
|
||||
}
|
||||
|
@ -18,24 +18,15 @@ import (
|
||||
"bytes"
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
cryptorand "crypto/rand"
|
||||
"crypto/rand"
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"encoding/pem"
|
||||
"math/big"
|
||||
mathrand "math/rand"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type mathRandReader struct{}
|
||||
|
||||
func (mathRandReader) Read(p []byte) (n int, err error) {
|
||||
return mathrand.Read(p)
|
||||
}
|
||||
|
||||
var randReader mathRandReader
|
||||
|
||||
type pemCertificate struct {
|
||||
Certificate []byte
|
||||
PrivateKey []byte
|
||||
@ -44,7 +35,7 @@ type pemCertificate struct {
|
||||
// Based on https://golang.org/src/crypto/tls/generate_cert.go,
|
||||
// simplified and weakened.
|
||||
func generateWeakCertificate() (*pemCertificate, error) {
|
||||
priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader)
|
||||
priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -52,7 +43,7 @@ func generateWeakCertificate() (*pemCertificate, error) {
|
||||
notBefore := time.Now()
|
||||
notAfter := notBefore.Add(time.Hour)
|
||||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||
serialNumber, err := cryptorand.Int(randReader, serialNumberLimit)
|
||||
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -69,7 +60,7 @@ func generateWeakCertificate() (*pemCertificate, error) {
|
||||
DNSNames: []string{"localhost"},
|
||||
IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)},
|
||||
}
|
||||
derBytes, err := x509.CreateCertificate(randReader, &template, &template, &priv.PublicKey, priv)
|
||||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user