Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Nov 13, 2022
1 parent 9b301a3 commit f9bcb9c
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 56 deletions.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

// Version of GoatCounter; set at compile-time with:
//
// -ldflags="-X zgo.at/goatcounter/v2.Version=XXXX"
// -ldflags="-X zgo.at/goatcounter/v2.Version="

var Version = "dev"

Expand Down
16 changes: 8 additions & 8 deletions gctest/gctest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ func TestSite(t *testing.T) {
}

{
s := goatcounter.Site{Cname: ztype.Ptr("XXX.XXX")}
u := goatcounter.User{Email: "[email protected]"}
s := goatcounter.Site{Cname: ztype.Ptr("AAA.AAA")}
u := goatcounter.User{Email: "[email protected]"}
Site(ctx, t, &s, &u)

if s.ID == 0 || *s.Cname != "XXX.XXX" {
if s.ID == 0 || *s.Cname != "AAA.AAA" {
t.Error()
}
if u.ID == 0 || u.Email != "[email protected]" {
if u.ID == 0 || u.Email != "[email protected]" {
t.Error()
}

Expand All @@ -81,11 +81,11 @@ func TestSite(t *testing.T) {
site_id cname
1 gctest.localhost
2 NULL
3 XXX.XXX
3 AAA.AAA
user_id site_id email
1 1 [email protected]
2 2 [email protected]
3 3 [email protected]`
3 3 [email protected]`
if d := zdb.Diff(got, want); d != "" {
t.Error(d)
}
Expand All @@ -99,12 +99,12 @@ func TestSite(t *testing.T) {
site_id cname
1 gctest.localhost
2 NULL
3 XXX.XXX
3 AAA.AAA
4 NULL
user_id site_id email
1 1 [email protected]
2 2 [email protected]
3 3 [email protected]
3 3 [email protected]
4 4 [email protected]`
if d := zdb.Diff(got, want); d != "" {
t.Error(d)
Expand Down
22 changes: 12 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ module zgo.at/goatcounter/v2

go 1.19

replace zgo.at/bgrun => ../Golib/bgrun

require (
code.soquee.net/otp v0.0.4
github.com/BurntSushi/toml v1.2.1
github.com/PuerkitoBio/goquery v1.8.0
github.com/bmatcuk/doublestar/v4 v4.2.0
github.com/bmatcuk/doublestar/v4 v4.4.0
github.com/boombuler/barcode v1.0.1
github.com/go-chi/chi/v5 v5.0.7
github.com/google/uuid v1.3.0
Expand All @@ -16,10 +18,10 @@ require (
github.com/oschwald/geoip2-golang v1.4.0
github.com/russross/blackfriday/v2 v2.1.0
github.com/teamwork/reload v1.4.2
golang.org/x/crypto v0.1.0
golang.org/x/exp v0.0.0-20221019170559-20944726eadf
golang.org/x/crypto v0.2.0
golang.org/x/exp v0.0.0-20221111204811-129d8d6c17ab
golang.org/x/image v0.1.0
golang.org/x/net v0.1.0
golang.org/x/net v0.2.0
golang.org/x/sync v0.1.0
golang.org/x/text v0.4.0
zgo.at/blackmail v0.0.0-20221021025740-b3fdfc32a1aa
Expand All @@ -34,12 +36,12 @@ require (
zgo.at/z18n v0.0.0-20221020022658-4ea64eeb51d9
zgo.at/zcache v1.2.0
zgo.at/zcache/v2 v2.1.0
zgo.at/zdb v0.0.0-20221026193338-d7af3d85e31a
zgo.at/zdb v0.0.0-20221105060706-d862504dc723
zgo.at/zhttp v0.0.0-20221020124111-c3011d53484c
zgo.at/zli v0.0.0-20221012220610-d6a5a841b943
zgo.at/zlog v0.0.0-20211008102840-46c1167bf2a9
zgo.at/zprof v0.0.0-20211217104121-c3c12596d8f0
zgo.at/zstd v0.0.0-20221031120442-2f4b628d1acb
zgo.at/zstd v0.0.0-20221107175747-9855306d942d
zgo.at/ztpl v0.0.0-20221020022020-7d727686f6a2
zgo.at/zvalidate v0.0.0-20221021025449-cb54fa8efade
)
Expand All @@ -57,8 +59,8 @@ require (
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/oschwald/maxminddb-golang v1.10.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/term v0.2.0 // indirect
golang.org/x/tools v0.2.0 // indirect
)
38 changes: 20 additions & 18 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions handlers/count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"zgo.at/zstd/zjson"
"zgo.at/zstd/ztest"
"zgo.at/zstd/ztime"
"zgo.at/zstd/ztype"
)

func TestBackendCount(t *testing.T) {
Expand Down Expand Up @@ -56,38 +57,38 @@ func TestBackendCount(t *testing.T) {
{"ref", url.Values{"p": {"/foo.html"}, "r": {"https://example.com"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Ref: "example.com",
RefScheme: ztest.SP("h"),
RefScheme: ztype.Ptr("h"),
}},

{"str ref", url.Values{"p": {"/foo.html"}, "r": {"example"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Ref: "example",
RefScheme: ztest.SP("o"),
RefScheme: ztype.Ptr("o"),
}},

{"ref params", url.Values{"p": {"/foo.html"}, "r": {"https://example.com?p=x"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Ref: "example.com",
RefScheme: ztest.SP("h"),
RefScheme: ztype.Ptr("h"),
}},

{"full", url.Values{"p": {"/foo.html"}, "t": {"XX"}, "r": {"https://example.com?p=x"}, "s": {"40,50,1"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Title: "XX",
Ref: "example.com",
RefScheme: ztest.SP("h"),
RefScheme: ztype.Ptr("h"),
Size: goatcounter.Floats{40, 50, 1},
}},

{"campaign", url.Values{"p": {"/foo.html"}, "q": {"ref=XXX"}}, nil, 200, goatcounter.Hit{
{"campaign", url.Values{"p": {"/foo.html"}, "q": {"ref=AAA"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Ref: "XXX",
RefScheme: ztest.SP("c"),
Ref: "AAA",
RefScheme: ztype.Ptr("c"),
}},
{"campaign_override", url.Values{"p": {"/foo.html?ref=AAA"}, "q": {"ref=XXX"}}, nil, 200, goatcounter.Hit{
{"campaign_override", url.Values{"p": {"/foo.html?ref=AAA"}, "q": {"ref=AAA"}}, nil, 200, goatcounter.Hit{
Path: "/foo.html",
Ref: "XXX",
RefScheme: ztest.SP("c"),
Ref: "AAA",
RefScheme: ztype.Ptr("c"),
}},

{"bot", url.Values{"p": {"/a"}, "b": {"150"}}, nil, 200, goatcounter.Hit{
Expand Down
11 changes: 5 additions & 6 deletions hit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

. "zgo.at/goatcounter/v2"
"zgo.at/goatcounter/v2/gctest"
"zgo.at/zstd/ztest"
"zgo.at/zstd/ztype"
)

Expand All @@ -24,7 +23,7 @@ func dayStat(days map[int]int) []int {

func TestHitDefaultsRef(t *testing.T) {
a := "arp242.net"
set := ztest.SP("_")
set := ztype.Ptr("_")

tests := []struct {
in string
Expand All @@ -39,22 +38,22 @@ func TestHitDefaultsRef(t *testing.T) {

// Split out query parameters.
{"https://arp242.net", a, nil, nil, "h"},
{"https://arp242.net?a=b", a, ztest.SP("a=b"), nil, "h"},
{"https://arp242.net?a=b&c=d", a, ztest.SP("a=b&c=d"), nil, "h"},
{"https://arp242.net?a=b", a, ztype.Ptr("a=b"), nil, "h"},
{"https://arp242.net?a=b&c=d", a, ztype.Ptr("a=b&c=d"), nil, "h"},

// Clean up query parameters.
{"https://t.co/asd", "twitter.com/search?q=https%3A%2F%2Ft.co%2Fasd", nil, nil, "h"},
{"https://t.co/asd?amp=1", "twitter.com/search?q=https%3A%2F%2Ft.co%2Fasd", nil, nil, "h"},
{"https://arp242.net?utm_source=asd", a, nil, set, "h"},
{"https://arp242.net?utm_source=asd&a=b", a, ztest.SP("a=b"), set, "h"},
{"https://arp242.net?utm_source=asd&a=b", a, ztype.Ptr("a=b"), set, "h"},

// Groups
{"https://mail.google.com?a=b&c=d", "Email", nil, set, "g"},
{"android-app://com.laurencedawson.reddit_sync.pro", "www.reddit.com", nil, set, "g"},

// Host aliases.
{"https://en.m.wikipedia.org/wiki/Foo", "en.wikipedia.org/wiki/Foo", nil, set, "h"},
{"https://en.m.wikipedia.org/wiki/Foo?a=b", "en.wikipedia.org/wiki/Foo", ztest.SP("a=b"), set, "h"},
{"https://en.m.wikipedia.org/wiki/Foo?a=b", "en.wikipedia.org/wiki/Foo", ztype.Ptr("a=b"), set, "h"},

// Reddit Cleaning.
{"https://www.reddit.com/r/programming/top", "www.reddit.com/r/programming", nil, set, "h"},
Expand Down
2 changes: 1 addition & 1 deletion ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func cleanRefURL(ref string, refURL *url.URL) (string, bool) {
// getpocket.com/a/read/2580004052
// getpocket.com/recommendations
// getpocket.com/redirect
// getpocket.com/users/XXX/feed/read
// getpocket.com/users/AAA/feed/read
if refURL.Host == "getpocket.com" || refURL.Host == "app.getpocket.com" {
return "getpocket.com", false
}
Expand Down
2 changes: 1 addition & 1 deletion tpl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestTpl(t *testing.T) {
NumRows: ip(42),
Size: sp("42"),
LastHitID: i64p(642051),
Hash: sp("sha256-XXX"),
Hash: sp("sha256-AAA"),
}}},
}

Expand Down
2 changes: 1 addition & 1 deletion user.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ func (u *UserAccesses) Scan(v interface{}) error {
case string:
return json.Unmarshal([]byte(vv), u)
default:
return fmt.Errorf("XXX.Scan: unsupported type: %T", v)
return fmt.Errorf("UserAccesses.Scan: unsupported type: %T", v)
}
}

Expand Down

0 comments on commit f9bcb9c

Please sign in to comment.