Skip to content

Commit

Permalink
fix(datasources): Properly support aws+sm with args (#2291)
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson authored Dec 17, 2024
1 parent d7e8e19 commit ddc4efb
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 23 deletions.
37 changes: 28 additions & 9 deletions internal/datafs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"net/url"
"os"
"path"
"runtime"
"strings"

Expand Down Expand Up @@ -89,7 +90,7 @@ func (d *dsReader) ReadSource(ctx context.Context, alias string, args ...string)
if len(args) > 0 {
arg = args[0]
}
u, err := resolveURL(source.URL, arg)
u, err := resolveURL(*source.URL, arg)
if err != nil {
return "", nil, err
}
Expand Down Expand Up @@ -191,11 +192,9 @@ func (d *dsReader) readFileContent(ctx context.Context, u *url.URL, hdr http.Hea
// resolveURL parses the relative URL rel against base, and returns the
// resolved URL. Differs from url.ResolveReference in that query parameters are
// added. In case of duplicates, params from rel are used.
func resolveURL(base *url.URL, rel string) (*url.URL, error) {
// if there's an opaque part, there's no resolving to do - just return the
// base URL
if base.Opaque != "" {
return base, nil
func resolveURL(base url.URL, rel string) (*url.URL, error) {
if rel == "" {
return &base, nil
}

// git URLs are special - they have double-slashes that separate a repo
Expand All @@ -220,6 +219,28 @@ func resolveURL(base *url.URL, rel string) (*url.URL, error) {
if strings.HasPrefix(rel, "//") {
rel = "." + rel
}
case "aws+sm":
// aws+sm URLs may be opaque, so resolution needs to be handled
// differently
if base.Opaque != "" {
// if it's opaque and we have a relative path we'll append it to
// the opaque part
if rel != "" {
base.Opaque = path.Join(base.Opaque, rel)
}

return &base, nil
} else if base.Path == "" && !strings.HasPrefix(rel, "/") {
// if the base has no path and the relative URL doesn't start with
// a slash, we treat it as opaque
base.Opaque = rel
}
}

// if there's still an opaque part, there's no resolving to do - just return
// the base URL
if base.Opaque != "" {
return &base, nil
}

relURL, err := url.Parse(rel)
Expand All @@ -232,16 +253,14 @@ func resolveURL(base *url.URL, rel string) (*url.URL, error) {
// correct for that.
var out *url.URL
switch {
case rel == "":
out = base
case base.IsAbs():
out = base.ResolveReference(relURL)
case base.Scheme == "" && base.Path[0] == '/':
// absolute path, no scheme or volume
out = base.ResolveReference(relURL)
out.Path = out.Path[1:]
default:
out = resolveRelativeURL(base, relURL)
out = resolveRelativeURL(&base, relURL)
}

if base.RawQuery != "" {
Expand Down
81 changes: 67 additions & 14 deletions internal/datafs/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datafs

import (
"context"
"fmt"
"net/http"
"net/http/httptest"
"net/url"
Expand All @@ -21,64 +22,116 @@ import (
const osWindows = "windows"

func TestResolveURL(t *testing.T) {
out, err := resolveURL(mustParseURL("http://example.com/foo.json"), "bar.json")
out, err := resolveURL(*mustParseURL("http://example.com/foo.json"), "bar.json")
require.NoError(t, err)
assert.Equal(t, "http://example.com/bar.json", out.String())

out, err = resolveURL(mustParseURL("http://example.com/a/b/?n=2"), "bar.json?q=1")
out, err = resolveURL(*mustParseURL("http://example.com/a/b/?n=2"), "bar.json?q=1")
require.NoError(t, err)
assert.Equal(t, "http://example.com/a/b/bar.json?n=2&q=1", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/myrepo"), "//myfile?type=application/json")
out, err = resolveURL(*mustParseURL("git+file:///tmp/myrepo"), "//myfile?type=application/json")
require.NoError(t, err)
assert.Equal(t, "git+file:///tmp/myrepo//myfile?type=application/json", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/foo/bar/"), "//myfile?type=application/json")
out, err = resolveURL(*mustParseURL("git+file:///tmp/foo/bar/"), "//myfile?type=application/json")
require.NoError(t, err)
assert.Equal(t, "git+file:///tmp/foo/bar//myfile?type=application/json", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/myrepo/"), ".//myfile?type=application/json")
out, err = resolveURL(*mustParseURL("git+file:///tmp/myrepo/"), ".//myfile?type=application/json")
require.NoError(t, err)
assert.Equal(t, "git+file:///tmp/myrepo//myfile?type=application/json", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/repo//foo.txt"), "")
out, err = resolveURL(*mustParseURL("git+file:///tmp/repo//foo.txt"), "")
require.NoError(t, err)
assert.Equal(t, "git+file:///tmp/repo//foo.txt", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/myrepo"), ".//myfile?type=application/json")
out, err = resolveURL(*mustParseURL("git+file:///tmp/myrepo"), ".//myfile?type=application/json")
require.NoError(t, err)
assert.Equal(t, "git+file:///tmp/myrepo//myfile?type=application/json", out.String())

out, err = resolveURL(mustParseURL("git+file:///tmp/myrepo//foo/?type=application/json"), "bar/myfile")
out, err = resolveURL(*mustParseURL("git+file:///tmp/myrepo//foo/?type=application/json"), "bar/myfile")
require.NoError(t, err)
// note that the '/' in the query string is encoded to %2F - that's OK
assert.Equal(t, "git+file:///tmp/myrepo//foo/bar/myfile?type=application%2Fjson", out.String())

// both base and relative may not contain "//"
_, err = resolveURL(mustParseURL("git+ssh://[email protected]/foo//bar"), ".//myfile")
_, err = resolveURL(*mustParseURL("git+ssh://[email protected]/foo//bar"), ".//myfile")
require.Error(t, err)

_, err = resolveURL(mustParseURL("git+ssh://[email protected]/foo//bar"), "baz//myfile")
_, err = resolveURL(*mustParseURL("git+ssh://[email protected]/foo//bar"), "baz//myfile")
require.Error(t, err)

// relative base URLs must remain relative
out, err = resolveURL(mustParseURL("tmp/foo.json"), "")
out, err = resolveURL(*mustParseURL("tmp/foo.json"), "")
require.NoError(t, err)
assert.Equal(t, "tmp/foo.json", out.String())

// relative implicit file URLs without volume or scheme are OK
out, err = resolveURL(mustParseURL("/tmp/"), "foo.json")
out, err = resolveURL(*mustParseURL("/tmp/"), "foo.json")
require.NoError(t, err)
assert.Equal(t, "tmp/foo.json", out.String())

// relative base URLs in parent directories are OK
out, err = resolveURL(mustParseURL("../../tmp/foo.json"), "")
out, err = resolveURL(*mustParseURL("../../tmp/foo.json"), "")
require.NoError(t, err)
assert.Equal(t, "../../tmp/foo.json", out.String())

out, err = resolveURL(mustParseURL("../../tmp/"), "sub/foo.json")
out, err = resolveURL(*mustParseURL("../../tmp/"), "sub/foo.json")
require.NoError(t, err)
assert.Equal(t, "../../tmp/sub/foo.json", out.String())

t.Run("aws+sm", func(t *testing.T) {
out, err = resolveURL(*mustParseURL("aws+sm:"), "foo")
require.NoError(t, err)
assert.Equal(t, "aws+sm:foo", out.String())

out, err = resolveURL(*mustParseURL("aws+sm:foo/"), "bar")
require.NoError(t, err)
assert.Equal(t, "aws+sm:foo/bar", out.String())

out, err = resolveURL(*mustParseURL("aws+sm:"), "/foo")
require.NoError(t, err)
assert.Equal(t, "aws+sm:///foo", out.String())

out, err = resolveURL(*mustParseURL("aws+sm:///foo/"), "bar")
require.NoError(t, err)
assert.Equal(t, "aws+sm:///foo/bar", out.String())
})
}

func BenchmarkResolveURL(b *testing.B) {
args := []struct {
url url.URL
rel string
}{
{*mustParseURL("http://example.com/foo.json"), "bar.json"},
{*mustParseURL("http://example.com/a/b/?n=2"), "bar.json?q=1"},
{*mustParseURL("git+file:///tmp/myrepo"), "//myfile?type=application/json"},
{*mustParseURL("git+file:///tmp/myrepo2"), ".//myfile?type=application/json"},
{*mustParseURL("git+file:///tmp/foo/bar/"), "//myfile?type=application/json"},
{*mustParseURL("git+file:///tmp/myrepo/"), ".//myfile?type=application/json"},
{*mustParseURL("git+file:///tmp/repo//foo.txt"), ""},
{*mustParseURL("git+file:///tmp/myrepo//foo/?type=application/json"), "bar/myfile"},
{*mustParseURL("tmp/foo.json"), ""},
{*mustParseURL("/tmp/"), "foo.json"},
{*mustParseURL("../../tmp/foo.json"), ""},
{*mustParseURL("../../tmp/"), "sub/foo.json"},
{*mustParseURL("aws+sm:"), "foo"},
{*mustParseURL("aws+sm:"), "/foo"},
{*mustParseURL("aws+sm:foo"), "bar"},
{*mustParseURL("aws+sm:///foo"), "bar"},
}

b.ResetTimer()

for _, a := range args {
b.Run(fmt.Sprintf("base=%s_rel=%s", &a.url, a.rel), func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = resolveURL(a.url, a.rel)
}
})
}
}

func TestReadFileContent(t *testing.T) {
Expand Down

1 comment on commit ddc4efb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: ddc4efb Previous: 66fd58b Ratio
BenchmarkFlatten/depth-1_[]int([1_2_3]) 170.3 ns/op 168 B/op 5 allocs/op 165.7 ns/op 168 B/op 5 allocs/op 1.03
BenchmarkFlatten/depth-1_[]int([1_2_3]) - ns/op 170.3 ns/op 165.7 ns/op 1.03
BenchmarkFlatten/depth-1_[]int([1_2_3]) - B/op 168 B/op 168 B/op 1
BenchmarkFlatten/depth-1_[]int([1_2_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth-1_[3]int([1_2_3]) 118.6 ns/op 144 B/op 2 allocs/op 117.2 ns/op 144 B/op 2 allocs/op 1.01
BenchmarkFlatten/depth-1_[3]int([1_2_3]) - ns/op 118.6 ns/op 117.2 ns/op 1.01
BenchmarkFlatten/depth-1_[3]int([1_2_3]) - B/op 144 B/op 144 B/op 1
BenchmarkFlatten/depth-1_[3]int([1_2_3]) - allocs/op 2 allocs/op 2 allocs/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[]_[1_2]_3]) 205.7 ns/op 208 B/op 5 allocs/op 203.4 ns/op 208 B/op 5 allocs/op 1.01
BenchmarkFlatten/depth-1_[]interface_{}([[]_[1_2]_3]) - ns/op 205.7 ns/op 203.4 ns/op 1.01
BenchmarkFlatten/depth-1_[]interface_{}([[]_[1_2]_3]) - B/op 208 B/op 208 B/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[]_[1_2]_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[1_2]]_3]) 430.2 ns/op 344 B/op 11 allocs/op 422.8 ns/op 344 B/op 11 allocs/op 1.02
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[1_2]]_3]) - ns/op 430.2 ns/op 422.8 ns/op 1.02
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[1_2]]_3]) - B/op 344 B/op 344 B/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[1_2]]_3]) - allocs/op 11 allocs/op 11 allocs/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) 831.7 ns/op 896 B/op 19 allocs/op 791.2 ns/op 896 B/op 19 allocs/op 1.05
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - ns/op 831.7 ns/op 791.2 ns/op 1.05
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - B/op 896 B/op 896 B/op 1
BenchmarkFlatten/depth-1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - allocs/op 19 allocs/op 19 allocs/op 1
BenchmarkFlatten/depth0_[]int([1_2_3]) 117 ns/op 72 B/op 4 allocs/op 114.2 ns/op 72 B/op 4 allocs/op 1.02
BenchmarkFlatten/depth0_[]int([1_2_3]) - ns/op 117 ns/op 114.2 ns/op 1.02
BenchmarkFlatten/depth0_[]int([1_2_3]) - B/op 72 B/op 72 B/op 1
BenchmarkFlatten/depth0_[]int([1_2_3]) - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkFlatten/depth0_[3]int([1_2_3]) 64.03 ns/op 48 B/op 1 allocs/op 63.74 ns/op 48 B/op 1 allocs/op 1.00
BenchmarkFlatten/depth0_[3]int([1_2_3]) - ns/op 64.03 ns/op 63.74 ns/op 1.00
BenchmarkFlatten/depth0_[3]int([1_2_3]) - B/op 48 B/op 48 B/op 1
BenchmarkFlatten/depth0_[3]int([1_2_3]) - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkFlatten/depth0_[]interface_{}([[]_[1_2]_3]) 4.331 ns/op 0 B/op 0 allocs/op 4.33 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkFlatten/depth0_[]interface_{}([[]_[1_2]_3]) - ns/op 4.331 ns/op 4.33 ns/op 1.00
BenchmarkFlatten/depth0_[]interface_{}([[]_[1_2]_3]) - B/op 0 B/op 0 B/op 1
BenchmarkFlatten/depth0_[]interface_{}([[]_[1_2]_3]) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[1_2]]_3]) 4.34 ns/op 0 B/op 0 allocs/op 4.442 ns/op 0 B/op 0 allocs/op 0.98
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[1_2]]_3]) - ns/op 4.34 ns/op 4.442 ns/op 0.98
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[1_2]]_3]) - B/op 0 B/op 0 B/op 1
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[1_2]]_3]) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) 4.339 ns/op 0 B/op 0 allocs/op 4.301 ns/op 0 B/op 0 allocs/op 1.01
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - ns/op 4.339 ns/op 4.301 ns/op 1.01
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - B/op 0 B/op 0 B/op 1
BenchmarkFlatten/depth0_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkFlatten/depth1_[]int([1_2_3]) 172.2 ns/op 168 B/op 5 allocs/op 166.1 ns/op 168 B/op 5 allocs/op 1.04
BenchmarkFlatten/depth1_[]int([1_2_3]) - ns/op 172.2 ns/op 166.1 ns/op 1.04
BenchmarkFlatten/depth1_[]int([1_2_3]) - B/op 168 B/op 168 B/op 1
BenchmarkFlatten/depth1_[]int([1_2_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth1_[3]int([1_2_3]) 126.3 ns/op 144 B/op 2 allocs/op 116.9 ns/op 144 B/op 2 allocs/op 1.08
BenchmarkFlatten/depth1_[3]int([1_2_3]) - ns/op 126.3 ns/op 116.9 ns/op 1.08
BenchmarkFlatten/depth1_[3]int([1_2_3]) - B/op 144 B/op 144 B/op 1
BenchmarkFlatten/depth1_[3]int([1_2_3]) - allocs/op 2 allocs/op 2 allocs/op 1
BenchmarkFlatten/depth1_[]interface_{}([[]_[1_2]_3]) 159.3 ns/op 144 B/op 4 allocs/op 157.9 ns/op 144 B/op 4 allocs/op 1.01
BenchmarkFlatten/depth1_[]interface_{}([[]_[1_2]_3]) - ns/op 159.3 ns/op 157.9 ns/op 1.01
BenchmarkFlatten/depth1_[]interface_{}([[]_[1_2]_3]) - B/op 144 B/op 144 B/op 1
BenchmarkFlatten/depth1_[]interface_{}([[]_[1_2]_3]) - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[1_2]]_3]) 216.7 ns/op 168 B/op 5 allocs/op 210.8 ns/op 168 B/op 5 allocs/op 1.03
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[1_2]]_3]) - ns/op 216.7 ns/op 210.8 ns/op 1.03
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[1_2]]_3]) - B/op 168 B/op 168 B/op 1
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[1_2]]_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) 144.5 ns/op 128 B/op 3 allocs/op 140.6 ns/op 128 B/op 3 allocs/op 1.03
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - ns/op 144.5 ns/op 140.6 ns/op 1.03
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - B/op 128 B/op 128 B/op 1
BenchmarkFlatten/depth1_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkFlatten/depth2_[]int([1_2_3]) 170.2 ns/op 168 B/op 5 allocs/op 166.3 ns/op 168 B/op 5 allocs/op 1.02
BenchmarkFlatten/depth2_[]int([1_2_3]) - ns/op 170.2 ns/op 166.3 ns/op 1.02
BenchmarkFlatten/depth2_[]int([1_2_3]) - B/op 168 B/op 168 B/op 1
BenchmarkFlatten/depth2_[]int([1_2_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth2_[3]int([1_2_3]) 117.4 ns/op 144 B/op 2 allocs/op 116.9 ns/op 144 B/op 2 allocs/op 1.00
BenchmarkFlatten/depth2_[3]int([1_2_3]) - ns/op 117.4 ns/op 116.9 ns/op 1.00
BenchmarkFlatten/depth2_[3]int([1_2_3]) - B/op 144 B/op 144 B/op 1
BenchmarkFlatten/depth2_[3]int([1_2_3]) - allocs/op 2 allocs/op 2 allocs/op 1
BenchmarkFlatten/depth2_[]interface_{}([[]_[1_2]_3]) 211.7 ns/op 208 B/op 5 allocs/op 203.9 ns/op 208 B/op 5 allocs/op 1.04
BenchmarkFlatten/depth2_[]interface_{}([[]_[1_2]_3]) - ns/op 211.7 ns/op 203.9 ns/op 1.04
BenchmarkFlatten/depth2_[]interface_{}([[]_[1_2]_3]) - B/op 208 B/op 208 B/op 1
BenchmarkFlatten/depth2_[]interface_{}([[]_[1_2]_3]) - allocs/op 5 allocs/op 5 allocs/op 1
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[1_2]]_3]) 378.9 ns/op 280 B/op 10 allocs/op 368.6 ns/op 280 B/op 10 allocs/op 1.03
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[1_2]]_3]) - ns/op 378.9 ns/op 368.6 ns/op 1.03
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[1_2]]_3]) - B/op 280 B/op 280 B/op 1
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[1_2]]_3]) - allocs/op 10 allocs/op 10 allocs/op 1
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) 319.3 ns/op 272 B/op 8 allocs/op 324.6 ns/op 272 B/op 8 allocs/op 0.98
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - ns/op 319.3 ns/op 324.6 ns/op 0.98
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - B/op 272 B/op 272 B/op 1
BenchmarkFlatten/depth2_[]interface_{}([[one]_[[[1]_[2_[3]]]_[4_5]]_6]) - allocs/op 8 allocs/op 8 allocs/op 1
BenchmarkInterfaceSlice/[]int([1_2_3]) 117.9 ns/op 72 B/op 4 allocs/op 112.6 ns/op 72 B/op 4 allocs/op 1.05
BenchmarkInterfaceSlice/[]int([1_2_3]) - ns/op 117.9 ns/op 112.6 ns/op 1.05
BenchmarkInterfaceSlice/[]int([1_2_3]) - B/op 72 B/op 72 B/op 1
BenchmarkInterfaceSlice/[]int([1_2_3]) - allocs/op 4 allocs/op 4 allocs/op 1
BenchmarkInterfaceSlice/[3]int([1_2_3]) 63.12 ns/op 48 B/op 1 allocs/op 60.15 ns/op 48 B/op 1 allocs/op 1.05
BenchmarkInterfaceSlice/[3]int([1_2_3]) - ns/op 63.12 ns/op 60.15 ns/op 1.05
BenchmarkInterfaceSlice/[3]int([1_2_3]) - B/op 48 B/op 48 B/op 1
BenchmarkInterfaceSlice/[3]int([1_2_3]) - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkInterfaceSlice/[]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) 578.1 ns/op 384 B/op 13 allocs/op 536.3 ns/op 384 B/op 13 allocs/op 1.08
BenchmarkInterfaceSlice/[]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - ns/op 578.1 ns/op 536.3 ns/op 1.08
BenchmarkInterfaceSlice/[]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - B/op 384 B/op 384 B/op 1
BenchmarkInterfaceSlice/[]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - allocs/op 13 allocs/op 13 allocs/op 1
BenchmarkInterfaceSlice/[12]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) 161.7 ns/op 192 B/op 1 allocs/op 152.9 ns/op 192 B/op 1 allocs/op 1.06
BenchmarkInterfaceSlice/[12]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - ns/op 161.7 ns/op 152.9 ns/op 1.06
BenchmarkInterfaceSlice/[12]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - B/op 192 B/op 192 B/op 1
BenchmarkInterfaceSlice/[12]string([foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz]) - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkInterfaceSlice/[]interface_{}([[]_[1_2]_3]) 2.167 ns/op 0 B/op 0 allocs/op 2.202 ns/op 0 B/op 0 allocs/op 0.98
BenchmarkInterfaceSlice/[]interface_{}([[]_[1_2]_3]) - ns/op 2.167 ns/op 2.202 ns/op 0.98
BenchmarkInterfaceSlice/[]interface_{}([[]_[1_2]_3]) - B/op 0 B/op 0 B/op 1
BenchmarkInterfaceSlice/[]interface_{}([[]_[1_2]_3]) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkInterfaceSlice/[3]interface_{}([[]_[1_2]_3]) 66.83 ns/op 48 B/op 1 allocs/op 63.17 ns/op 48 B/op 1 allocs/op 1.06
BenchmarkInterfaceSlice/[3]interface_{}([[]_[1_2]_3]) - ns/op 66.83 ns/op 63.17 ns/op 1.06
BenchmarkInterfaceSlice/[3]interface_{}([[]_[1_2]_3]) - B/op 48 B/op 48 B/op 1
BenchmarkInterfaceSlice/[3]interface_{}([[]_[1_2]_3]) - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkResolveURL/base=http://example.com/foo.json_rel=bar.json 597.1 ns/op 456 B/op 5 allocs/op
BenchmarkResolveURL/base=http://example.com/foo.json_rel=bar.json - ns/op 597.1 ns/op
BenchmarkResolveURL/base=http://example.com/foo.json_rel=bar.json - B/op 456 B/op
BenchmarkResolveURL/base=http://example.com/foo.json_rel=bar.json - allocs/op 5 allocs/op
BenchmarkResolveURL/base=git+file:///tmp/repo//foo.txt_rel= 79.72 ns/op 144 B/op 1 allocs/op
BenchmarkResolveURL/base=git+file:///tmp/repo//foo.txt_rel= - ns/op 79.72 ns/op
BenchmarkResolveURL/base=git+file:///tmp/repo//foo.txt_rel= - B/op 144 B/op
BenchmarkResolveURL/base=git+file:///tmp/repo//foo.txt_rel= - allocs/op 1 allocs/op
BenchmarkResolveURL/base=tmp/foo.json_rel= 78.7 ns/op 144 B/op 1 allocs/op
BenchmarkResolveURL/base=tmp/foo.json_rel= - ns/op 78.7 ns/op
BenchmarkResolveURL/base=tmp/foo.json_rel= - B/op 144 B/op
BenchmarkResolveURL/base=tmp/foo.json_rel= - allocs/op 1 allocs/op
BenchmarkResolveURL/base=/tmp/_rel=foo.json 622.3 ns/op 456 B/op 5 allocs/op
BenchmarkResolveURL/base=/tmp/_rel=foo.json - ns/op 622.3 ns/op
BenchmarkResolveURL/base=/tmp/_rel=foo.json - B/op 456 B/op
BenchmarkResolveURL/base=/tmp/_rel=foo.json - allocs/op 5 allocs/op
BenchmarkResolveURL/base=../../tmp/foo.json_rel= 79.08 ns/op 144 B/op 1 allocs/op
BenchmarkResolveURL/base=../../tmp/foo.json_rel= - ns/op 79.08 ns/op
BenchmarkResolveURL/base=../../tmp/foo.json_rel= - B/op 144 B/op
BenchmarkResolveURL/base=../../tmp/foo.json_rel= - allocs/op 1 allocs/op
BenchmarkResolveURL/base=../../tmp/_rel=sub/foo.json 1317 ns/op 840 B/op 14 allocs/op
BenchmarkResolveURL/base=../../tmp/_rel=sub/foo.json - ns/op 1317 ns/op
BenchmarkResolveURL/base=../../tmp/_rel=sub/foo.json - B/op 840 B/op
BenchmarkResolveURL/base=../../tmp/_rel=sub/foo.json - allocs/op 14 allocs/op
BenchmarkResolveURL/base=aws+sm:_rel=foo 81.74 ns/op 144 B/op 1 allocs/op
BenchmarkResolveURL/base=aws+sm:_rel=foo - ns/op 81.74 ns/op
BenchmarkResolveURL/base=aws+sm:_rel=foo - B/op 144 B/op
BenchmarkResolveURL/base=aws+sm:_rel=foo - allocs/op 1 allocs/op
BenchmarkResolveURL/base=aws+sm:_rel=/foo 433.9 ns/op 440 B/op 4 allocs/op
BenchmarkResolveURL/base=aws+sm:_rel=/foo - ns/op 433.9 ns/op
BenchmarkResolveURL/base=aws+sm:_rel=/foo - B/op 440 B/op
BenchmarkResolveURL/base=aws+sm:_rel=/foo - allocs/op 4 allocs/op
BenchmarkResolveURL/base=aws+sm:foo_rel=bar 147.6 ns/op 160 B/op 3 allocs/op
BenchmarkResolveURL/base=aws+sm:foo_rel=bar - ns/op 147.6 ns/op
BenchmarkResolveURL/base=aws+sm:foo_rel=bar - B/op 160 B/op
BenchmarkResolveURL/base=aws+sm:foo_rel=bar - allocs/op 3 allocs/op
BenchmarkResolveURL/base=aws+sm:///foo_rel=bar 479.4 ns/op 440 B/op 4 allocs/op
BenchmarkResolveURL/base=aws+sm:///foo_rel=bar - ns/op 479.4 ns/op
BenchmarkResolveURL/base=aws+sm:///foo_rel=bar - B/op 440 B/op
BenchmarkResolveURL/base=aws+sm:///foo_rel=bar - allocs/op 4 allocs/op
BenchmarkToBytes 1037 ns/op 40 B/op 3 allocs/op 1125 ns/op 40 B/op 3 allocs/op 0.92
BenchmarkToBytes - ns/op 1037 ns/op 1125 ns/op 0.92
BenchmarkToBytes - B/op 40 B/op 40 B/op 1
BenchmarkToBytes - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/int(0) 3.109 ns/op 0 B/op 0 allocs/op 3.178 ns/op 0 B/op 0 allocs/op 0.98
BenchmarkIsFloat/int(0) - ns/op 3.109 ns/op 3.178 ns/op 0.98
BenchmarkIsFloat/int(0) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int(0) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int(1) 3.097 ns/op 0 B/op 0 allocs/op 3.102 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/int(1) - ns/op 3.097 ns/op 3.102 ns/op 1.00
BenchmarkIsFloat/int(1) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int(1) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int(-1) 3.097 ns/op 0 B/op 0 allocs/op 3.135 ns/op 0 B/op 0 allocs/op 0.99
BenchmarkIsFloat/int(-1) - ns/op 3.097 ns/op 3.135 ns/op 0.99
BenchmarkIsFloat/int(-1) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int(-1) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/uint(42) 3.099 ns/op 0 B/op 0 allocs/op 3.097 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/uint(42) - ns/op 3.099 ns/op 3.097 ns/op 1.00
BenchmarkIsFloat/uint(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/uint(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/uint8(255) 3.102 ns/op 0 B/op 0 allocs/op 3.097 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/uint8(255) - ns/op 3.102 ns/op 3.097 ns/op 1.00
BenchmarkIsFloat/uint8(255) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/uint8(255) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/uint16(42) 3.099 ns/op 0 B/op 0 allocs/op 3.102 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/uint16(42) - ns/op 3.099 ns/op 3.102 ns/op 1.00
BenchmarkIsFloat/uint16(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/uint16(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/uint32(42) 3.099 ns/op 0 B/op 0 allocs/op 3.096 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/uint32(42) - ns/op 3.099 ns/op 3.096 ns/op 1.00
BenchmarkIsFloat/uint32(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/uint32(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/uint64(42) 3.095 ns/op 0 B/op 0 allocs/op 3.101 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/uint64(42) - ns/op 3.095 ns/op 3.101 ns/op 1.00
BenchmarkIsFloat/uint64(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/uint64(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int(42) 3.101 ns/op 0 B/op 0 allocs/op 3.101 ns/op 0 B/op 0 allocs/op 1
BenchmarkIsFloat/int(42) - ns/op 3.101 ns/op 3.101 ns/op 1
BenchmarkIsFloat/int(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int8(127) 3.099 ns/op 0 B/op 0 allocs/op 3.096 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/int8(127) - ns/op 3.099 ns/op 3.096 ns/op 1.00
BenchmarkIsFloat/int8(127) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int8(127) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int16(42) 3.1 ns/op 0 B/op 0 allocs/op 3.102 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/int16(42) - ns/op 3.1 ns/op 3.102 ns/op 1.00
BenchmarkIsFloat/int16(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int16(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int32(42) 3.095 ns/op 0 B/op 0 allocs/op 3.094 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/int32(42) - ns/op 3.095 ns/op 3.094 ns/op 1.00
BenchmarkIsFloat/int32(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int32(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/int64(42) 3.096 ns/op 0 B/op 0 allocs/op 3.1 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/int64(42) - ns/op 3.096 ns/op 3.1 ns/op 1.00
BenchmarkIsFloat/int64(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/int64(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/float32(18.3) 2.477 ns/op 0 B/op 0 allocs/op 2.786 ns/op 0 B/op 0 allocs/op 0.89
BenchmarkIsFloat/float32(18.3) - ns/op 2.477 ns/op 2.786 ns/op 0.89
BenchmarkIsFloat/float32(18.3) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/float32(18.3) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/float64(18.3) 2.787 ns/op 0 B/op 0 allocs/op 2.792 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/float64(18.3) - ns/op 2.787 ns/op 2.792 ns/op 1.00
BenchmarkIsFloat/float64(18.3) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/float64(18.3) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/float64(1.5) 2.785 ns/op 0 B/op 0 allocs/op 2.786 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/float64(1.5) - ns/op 2.785 ns/op 2.786 ns/op 1.00
BenchmarkIsFloat/float64(1.5) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/float64(1.5) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/float64(-18.6) 2.789 ns/op 0 B/op 0 allocs/op 2.789 ns/op 0 B/op 0 allocs/op 1
BenchmarkIsFloat/float64(-18.6) - ns/op 2.789 ns/op 2.789 ns/op 1
BenchmarkIsFloat/float64(-18.6) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/float64(-18.6) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/string(42) 34.8 ns/op 0 B/op 0 allocs/op 34.1 ns/op 0 B/op 0 allocs/op 1.02
BenchmarkIsFloat/string(42) - ns/op 34.8 ns/op 34.1 ns/op 1.02
BenchmarkIsFloat/string(42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/string(42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/string(052) 38.48 ns/op 0 B/op 0 allocs/op 38.08 ns/op 0 B/op 0 allocs/op 1.01
BenchmarkIsFloat/string(052) - ns/op 38.48 ns/op 38.08 ns/op 1.01
BenchmarkIsFloat/string(052) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/string(052) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/string(0xff) 73.87 ns/op 52 B/op 2 allocs/op 72.28 ns/op 52 B/op 2 allocs/op 1.02
BenchmarkIsFloat/string(0xff) - ns/op 73.87 ns/op 72.28 ns/op 1.02
BenchmarkIsFloat/string(0xff) - B/op 52 B/op 52 B/op 1
BenchmarkIsFloat/string(0xff) - allocs/op 2 allocs/op 2 allocs/op 1
BenchmarkIsFloat/string(-42) 36.9 ns/op 0 B/op 0 allocs/op 35.95 ns/op 0 B/op 0 allocs/op 1.03
BenchmarkIsFloat/string(-42) - ns/op 36.9 ns/op 35.95 ns/op 1.03
BenchmarkIsFloat/string(-42) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/string(-42) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/string(-0) 32.29 ns/op 0 B/op 0 allocs/op 32.63 ns/op 0 B/op 0 allocs/op 0.99
BenchmarkIsFloat/string(-0) - ns/op 32.29 ns/op 32.63 ns/op 0.99
BenchmarkIsFloat/string(-0) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/string(-0) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkIsFloat/string(3.14) 108.3 ns/op 56 B/op 3 allocs/op 105.3 ns/op 56 B/op 3 allocs/op 1.03
BenchmarkIsFloat/string(3.14) - ns/op 108.3 ns/op 105.3 ns/op 1.03
BenchmarkIsFloat/string(3.14) - B/op 56 B/op 56 B/op 1
BenchmarkIsFloat/string(3.14) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string(-3.14) 123 ns/op 64 B/op 3 allocs/op 112.2 ns/op 64 B/op 3 allocs/op 1.10
BenchmarkIsFloat/string(-3.14) - ns/op 123 ns/op 112.2 ns/op 1.10
BenchmarkIsFloat/string(-3.14) - B/op 64 B/op 64 B/op 1
BenchmarkIsFloat/string(-3.14) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string(0.00) 105.7 ns/op 56 B/op 3 allocs/op 105.8 ns/op 56 B/op 3 allocs/op 1.00
BenchmarkIsFloat/string(0.00) - ns/op 105.7 ns/op 105.8 ns/op 1.00
BenchmarkIsFloat/string(0.00) - B/op 56 B/op 56 B/op 1
BenchmarkIsFloat/string(0.00) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string(NaN) 97.28 ns/op 54 B/op 3 allocs/op 93.86 ns/op 54 B/op 3 allocs/op 1.04
BenchmarkIsFloat/string(NaN) - ns/op 97.28 ns/op 93.86 ns/op 1.04
BenchmarkIsFloat/string(NaN) - B/op 54 B/op 54 B/op 1
BenchmarkIsFloat/string(NaN) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string(-Inf) 102.2 ns/op 56 B/op 3 allocs/op 92.49 ns/op 56 B/op 3 allocs/op 1.10
BenchmarkIsFloat/string(-Inf) - ns/op 102.2 ns/op 92.49 ns/op 1.10
BenchmarkIsFloat/string(-Inf) - B/op 56 B/op 56 B/op 1
BenchmarkIsFloat/string(-Inf) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string(+Inf) 100.4 ns/op 56 B/op 3 allocs/op 93.17 ns/op 56 B/op 3 allocs/op 1.08
BenchmarkIsFloat/string(+Inf) - ns/op 100.4 ns/op 93.17 ns/op 1.08
BenchmarkIsFloat/string(+Inf) - B/op 56 B/op 56 B/op 1
BenchmarkIsFloat/string(+Inf) - allocs/op 3 allocs/op 3 allocs/op 1
BenchmarkIsFloat/string() 50.79 ns/op 48 B/op 1 allocs/op 49.84 ns/op 48 B/op 1 allocs/op 1.02
BenchmarkIsFloat/string() - ns/op 50.79 ns/op 49.84 ns/op 1.02
BenchmarkIsFloat/string() - B/op 48 B/op 48 B/op 1
BenchmarkIsFloat/string() - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkIsFloat/string(foo) 71.71 ns/op 51 B/op 2 allocs/op 69.53 ns/op 51 B/op 2 allocs/op 1.03
BenchmarkIsFloat/string(foo) - ns/op 71.71 ns/op 69.53 ns/op 1.03
BenchmarkIsFloat/string(foo) - B/op 51 B/op 51 B/op 1
BenchmarkIsFloat/string(foo) - allocs/op 2 allocs/op 2 allocs/op 1
BenchmarkIsFloat/bool(true) 3.096 ns/op 0 B/op 0 allocs/op 3.097 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkIsFloat/bool(true) - ns/op 3.096 ns/op 3.097 ns/op 1.00
BenchmarkIsFloat/bool(true) - B/op 0 B/op 0 B/op 1
BenchmarkIsFloat/bool(true) - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkLookupIPs 50232 ns/op 1872 B/op 46 allocs/op 50737 ns/op 1840 B/op 44 allocs/op 0.99
BenchmarkLookupIPs - ns/op 50232 ns/op 50737 ns/op 0.99
BenchmarkLookupIPs - B/op 1872 B/op 1840 B/op 1.02
BenchmarkLookupIPs - allocs/op 46 allocs/op 44 allocs/op 1.05
BenchmarkIndent 1841 ns/op 2040 B/op 18 allocs/op 1946 ns/op 2064 B/op 20 allocs/op 0.95
BenchmarkIndent - ns/op 1841 ns/op 1946 ns/op 0.95
BenchmarkIndent - B/op 2040 B/op 2064 B/op 0.99
BenchmarkIndent - allocs/op 18 allocs/op 20 allocs/op 0.90

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.