You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-23 22:34:47 +02:00
[chore]: enable usestdlibvars linter (#6001)
#### Description [usestdlibvars](https://golangci-lint.run/usage/linters/#usestdlibvars) is a linter that detect the possibility to use variables/constants from the Go standard library. Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
@@ -66,7 +66,7 @@ func TestHTTPSClientRequest(t *testing.T) {
|
||||
assert.Equal(
|
||||
t,
|
||||
[]attribute.KeyValue{
|
||||
attribute.String("http.method", "GET"),
|
||||
attribute.String("http.method", http.MethodGet),
|
||||
attribute.String("net.protocol.version", "1.0"),
|
||||
attribute.String("http.url", "https://127.0.0.1:443/resource"),
|
||||
attribute.String("net.peer.name", "127.0.0.1"),
|
||||
@@ -101,7 +101,7 @@ func TestHTTPClientRequest(t *testing.T) {
|
||||
assert.Equal(
|
||||
t,
|
||||
[]attribute.KeyValue{
|
||||
attribute.String("http.method", "GET"),
|
||||
attribute.String("http.method", http.MethodGet),
|
||||
attribute.String("net.protocol.version", "1.0"),
|
||||
attribute.String("http.url", "http://127.0.0.1:8080/resource"),
|
||||
attribute.String("net.peer.name", "127.0.0.1"),
|
||||
@@ -119,7 +119,7 @@ func TestHTTPClientRequestRequired(t *testing.T) {
|
||||
var got []attribute.KeyValue
|
||||
assert.NotPanics(t, func() { got = hc.ClientRequest(req) })
|
||||
want := []attribute.KeyValue{
|
||||
attribute.String("http.method", "GET"),
|
||||
attribute.String("http.method", http.MethodGet),
|
||||
attribute.String("net.protocol.name", ""),
|
||||
attribute.String("http.url", ""),
|
||||
attribute.String("net.peer.name", ""),
|
||||
@@ -157,7 +157,7 @@ func TestHTTPServerRequest(t *testing.T) {
|
||||
|
||||
assert.ElementsMatch(t,
|
||||
[]attribute.KeyValue{
|
||||
attribute.String("http.method", "GET"),
|
||||
attribute.String("http.method", http.MethodGet),
|
||||
attribute.String("http.scheme", "http"),
|
||||
attribute.String("net.protocol.version", "1.1"),
|
||||
attribute.String("net.host.name", srvURL.Hostname()),
|
||||
@@ -197,7 +197,7 @@ func TestHTTPServerRequestFailsGracefully(t *testing.T) {
|
||||
var got []attribute.KeyValue
|
||||
assert.NotPanics(t, func() { got = hc.ServerRequest("", req) })
|
||||
want := []attribute.KeyValue{
|
||||
attribute.String("http.method", "GET"),
|
||||
attribute.String("http.method", http.MethodGet),
|
||||
attribute.String("http.scheme", "http"),
|
||||
attribute.String("net.protocol.name", ""),
|
||||
attribute.String("net.host.name", ""),
|
||||
@@ -206,8 +206,8 @@ func TestHTTPServerRequestFailsGracefully(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMethod(t *testing.T) {
|
||||
assert.Equal(t, attribute.String("http.method", "POST"), hc.method("POST"))
|
||||
assert.Equal(t, attribute.String("http.method", "GET"), hc.method(""))
|
||||
assert.Equal(t, attribute.String("http.method", http.MethodPost), hc.method(http.MethodPost))
|
||||
assert.Equal(t, attribute.String("http.method", http.MethodGet), hc.method(""))
|
||||
assert.Equal(t, attribute.String("http.method", "garbage"), hc.method("garbage"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user