Skip to content

Commit

Permalink
Update a bunch of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jun 6, 2022
1 parent bc11e69 commit 0d28ba3
Show file tree
Hide file tree
Showing 22 changed files with 173 additions and 173 deletions.
4 changes: 2 additions & 2 deletions bosmang.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"zgo.at/zdb"
"zgo.at/zstd/zjson"
"zgo.at/zstd/zruntime"
"zgo.at/zstd/zstring"
"zgo.at/zstd/ztype"
)

type BosmangStat struct {
Expand Down Expand Up @@ -45,7 +45,7 @@ func (a *BosmangStats) List(ctx context.Context) error {
aa := *a
for i := range aa {
if aa[i].BillingAmount != nil {
aa[i].BillingAmount = zstring.NewPtr(curr.Replace(*aa[i].BillingAmount)).P
aa[i].BillingAmount = ztype.Ptr[string](curr.Replace(*aa[i].BillingAmount))
}
}
return nil
Expand Down
19 changes: 14 additions & 5 deletions cmd/goatcounter/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"zgo.at/zstd/zcrypto"
"zgo.at/zstd/zint"
"zgo.at/zstd/zstring"
"zgo.at/zstd/ztype"
"zgo.at/zvalidate"
)

Expand Down Expand Up @@ -335,7 +336,11 @@ func cmdDB(f zli.Flags, ready chan<- struct{}, stop chan struct{}) error {
)

start:
cmd := f.ShiftCommand()
cmd, err := f.ShiftCommand()
if err != nil && !errors.Is(err, zli.ErrCommandNoneGiven{}) {
return err
}

switch cmd {
default:
// Be forgiving if someone reverses the order of "create" and "site".
Expand All @@ -346,7 +351,7 @@ start:
}

return errors.Errorf("unknown command for \"db\": %q\n%s", cmd, helpDBShort)
case "", zli.CommandNoneGiven:
case "": //, zli.CommandNoneGiven:
return errors.New("\"db\" needs a subcommand\n" + helpDBShort)
case "help":
zli.WantColor = true
Expand Down Expand Up @@ -399,11 +404,15 @@ start:
}

func getTable(f *zli.Flags, cmd string) (string, error) {
tbl := f.ShiftCommand()
tbl, err := f.ShiftCommand()
if err != nil && !errors.Is(err, zli.ErrCommandNoneGiven{}) {
return "", err
}

switch tbl {
default:
return "", errors.Errorf("unknown table %q\n%s", tbl, helpDBShort)
case "", zli.CommandNoneGiven:
case "":
return "", errors.Errorf("%q commands needs a table name\n%s", cmd, helpDBShort)
case "help":
zli.WantColor = true
Expand Down Expand Up @@ -749,7 +758,7 @@ func cmdDBSiteUpdate(ctx context.Context, find []string,
}

if vhost.Set() {
s.Cname = zstring.NewPtr(vhost.String()).P
s.Cname = ztype.Ptr(vhost.String())
err := s.Update(ctx)
if err != nil {
return err
Expand Down
13 changes: 9 additions & 4 deletions cmd/goatcounter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,25 @@ func cmdMain(f zli.Flags, ready chan<- struct{}, stop chan struct{}) {
mainDone.Add(1)
defer mainDone.Done()

cmd := f.ShiftCommand()
cmd, err := f.ShiftCommand()
if zstring.ContainsAny(f.Args, "-h", "-help", "--help") {
f.Args = append([]string{cmd}, f.Args...)
cmd = "help"
}
if err != nil && !errors.Is(err, zli.ErrCommandNoneGiven{}) {
zli.Errorf(usage[""])
zli.Errorf("%s", err)
zli.Exit(1)
return
}

var run command
switch cmd {
default:
zli.Errorf(usage[""])
zli.Errorf("unknown command: %q", cmd)
zli.Exit(1)
return
case "", "help", zli.CommandNoneGiven:
case "", "help":
run = cmdHelp
case "version":
fmt.Fprintln(zli.Stdout, getVersion())
Expand Down Expand Up @@ -108,7 +113,7 @@ func cmdMain(f zli.Flags, ready chan<- struct{}, stop chan struct{}) {
return
}

err := run(f, ready, stop)
err = run(f, ready, stop)
if err != nil {
if !zstring.Contains(zlog.Config.Debug, "cli-trace") {
for {
Expand Down
6 changes: 3 additions & 3 deletions cmd/goatcounter/old.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// under the terms of a slightly modified EUPL v1.2 license, which can be found
// in the LICENSE file or at https://license.goatcounter.com

//go:build !go1.17
// +build !go1.17
//go:build !go1.18
// +build !go1.18

package main

// Make sure people don't try to build GoatCounter with older versions of Go, as
// that will introduce some runtime problems (e.g. using %w).
func init() {
"You need Go 1.17 or newer to compile GoatCounter"
"You need Go 1.18 or newer to compile GoatCounter"
}
10 changes: 5 additions & 5 deletions db/migrate/gomig/2020-12-31-1-user_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func UserAgents(ctx context.Context) error {
}

if strings.ContainsRune(u.UserAgent, '~') {
u.UserAgent = gadget.Unshorten(u.UserAgent)
u.UserAgent = gadget.UnshortenUA(u.UserAgent)
} else {
u.UserAgent = gadget.Shorten(u.UserAgent)
u.UserAgent = gadget.ShortenUA(u.UserAgent)
}

var dupes []int64
Expand Down Expand Up @@ -84,10 +84,10 @@ func UserAgents(ctx context.Context) error {
}

if strings.ContainsRune(u.UserAgent, '~') {
u.UserAgent = gadget.Unshorten(u.UserAgent)
u.UserAgent = gadget.UnshortenUA(u.UserAgent)
}

ua := gadget.Parse(u.UserAgent)
ua := gadget.ParseUA(u.UserAgent)

var browser goatcounter.Browser
err := browser.GetOrInsert(ctx, ua.BrowserName, ua.BrowserVersion)
Expand All @@ -106,7 +106,7 @@ func UserAgents(ctx context.Context) error {
bot := isbot.UserAgent(u.UserAgent)
err = zdb.Exec(ctx, `update user_agents
set browser_id=$1, system_id=$2, ua=$3, isbot=$4 where user_agent_id=$5`,
browser.ID, system.ID, gadget.Shorten(u.UserAgent), bot, u.ID)
browser.ID, system.ID, gadget.ShortenUA(u.UserAgent), bot, u.ID)
errs.Append(errors.Wrapf(err, "update user_agent %d", u.ID))
}
if errs.Len() > 0 {
Expand Down
2 changes: 1 addition & 1 deletion export.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (h *ExportRows) Export(ctx context.Context, limit, paginate int64) (int64,

hh := *h
for i := range hh {
hh[i].UserAgent = gadget.Unshorten(hh[i].UserAgent)
hh[i].UserAgent = gadget.UnshortenUA(hh[i].UserAgent)
}
*h = hh

Expand Down
4 changes: 2 additions & 2 deletions gctest/gctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"zgo.at/zdb/drivers/go-sqlite3"
"zgo.at/zstd/zcrypto"
"zgo.at/zstd/zgo"
"zgo.at/zstd/zstring"
"zgo.at/zstd/ztype"
)

var pgSQL = false
Expand Down Expand Up @@ -107,7 +107,7 @@ func db(t testing.TB, storeFile bool) context.Context {
}

func initData(ctx context.Context, db zdb.DB, t testing.TB) context.Context {
site := goatcounter.Site{Code: "gctest", Cname: zstring.NewPtr("gctest.localhost").P, Plan: goatcounter.PlanFree}
site := goatcounter.Site{Code: "gctest", Cname: ztype.Ptr("gctest.localhost"), Plan: goatcounter.PlanFree}
err := site.Insert(ctx)
if err != nil {
t.Fatalf("create site: %s", err)
Expand Down
4 changes: 2 additions & 2 deletions gctest/gctest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"zgo.at/goatcounter/v2"
"zgo.at/zdb"
"zgo.at/zlog"
"zgo.at/zstd/zstring"
"zgo.at/zstd/ztype"
)

func TestDB(t *testing.T) {
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestSite(t *testing.T) {
}

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

Expand Down
47 changes: 23 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
module zgo.at/goatcounter/v2

go 1.17
go 1.18

require (
code.soquee.net/otp v0.0.1
github.com/BurntSushi/toml v1.0.0
github.com/BurntSushi/toml v1.1.0
github.com/PuerkitoBio/goquery v1.8.0
github.com/bmatcuk/doublestar/v3 v3.0.0
github.com/bmatcuk/doublestar/v4 v4.0.2
github.com/boombuler/barcode v1.0.1
github.com/go-chi/chi/v5 v5.0.7
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/mattn/go-sqlite3 v1.14.12
github.com/mattn/go-sqlite3 v1.14.13
github.com/monoculum/formam v3.5.5+incompatible
github.com/oschwald/geoip2-golang v1.4.0
github.com/russross/blackfriday/v2 v2.1.0
github.com/teamwork/reload v1.4.0
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/image v0.0.0-20220302094943-723b81ca9867
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
github.com/teamwork/reload v1.4.1
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd
golang.org/x/net v0.0.0-20220531201128-c960675eff93
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/text v0.3.7
zgo.at/blackmail v0.0.0-20211212060815-1f8e8a94692b
zgo.at/errors v1.1.0
zgo.at/follow v0.0.0-20211017230838-112008350298
zgo.at/gadget v0.0.0-20220215192223-d8b0d7a0f8e8
zgo.at/gadget v1.0.0
zgo.at/guru v1.1.0
zgo.at/isbot v0.0.0-20220218084749-37964349899b
zgo.at/isbot v1.0.0
zgo.at/json v0.0.0-20211017213340-cc8bf51df08c
zgo.at/termtext v1.1.0
zgo.at/tz v0.0.0-20211017223207-006eae99adf6
zgo.at/z18n v0.0.0-20211201221236-c1ccdacc3808
zgo.at/zcache v1.0.1-0.20210412145246-76039d792310
zgo.at/zdb v0.0.0-20220305202237-4742bea134e5
zgo.at/z18n v0.0.0-20220606095325-513ddb98b28f
zgo.at/zcache v1.2.0
zgo.at/zdb v0.0.0-20220409200746-018582f47c20
zgo.at/zhttp v0.0.0-20220306174538-ede1552bdf7c
zgo.at/zli v0.0.0-20211215141047-76dae1509b03
zgo.at/zli v0.0.0-20220603144944-094944de19e6
zgo.at/zlog v0.0.0-20211008102840-46c1167bf2a9
zgo.at/zprof v0.0.0-20211217104121-c3c12596d8f0
zgo.at/zstd v0.0.0-20220306174247-aa79e904bd64
zgo.at/zstd v0.0.0-20220606095932-df1f8a2ae661
zgo.at/zstripe v1.1.1-0.20210407063143-62ac9deebc08
zgo.at/ztpl v0.0.0-20211128061406-6ff34b1256c4
zgo.at/zvalidate v0.0.0-20211128195927-d13b18611e62
Expand All @@ -47,17 +48,15 @@ require (
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/lib/pq v1.10.4 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/oschwald/maxminddb-golang v1.8.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // 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.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect
golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f // indirect
)

// https://github.com/Teamwork/reload/pull/12
replace github.com/teamwork/reload => github.com/arp242/reload v1.4.1-0.20220116060443-b28a54916036

// https://github.com/oschwald/maxminddb-golang/pull/75
replace github.com/oschwald/maxminddb-golang => github.com/arp242/maxminddb-golang v1.8.1-0.20201227124339-dc03187a9664

Expand Down
Loading

0 comments on commit 0d28ba3

Please sign in to comment.