From 5cde0b4fdb046654d9f06d2f88fcab6a762df8ef Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Wed, 10 Aug 2022 22:40:04 +0100 Subject: [PATCH] Go 1.18. --- go.mod | 6 +++--- go.sum | 8 ++++---- internal/zenutil/env.go | 3 --- util_unix.go | 10 +--------- zenity.go | 3 --- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 3681b04..5da5aa1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ncruces/zenity -go 1.17 +go 1.18 require ( github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f @@ -8,8 +8,8 @@ require ( github.com/ncruces/go-strftime v0.1.8 github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 go.uber.org/goleak v1.1.12 // test - golang.org/x/image v0.0.0-20220617043117-41969df76e82 - golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b + golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 + golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 ) require ( diff --git a/go.sum b/go.sum index f77b678..309e732 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/image v0.0.0-20220617043117-41969df76e82 h1:KpZB5pUSBvrHltNEdK/tw0xlPeD13M6M6aGP32gKqiw= -golang.org/x/image v0.0.0-20220617043117-41969df76e82/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -42,8 +42,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8= -golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs= +golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/internal/zenutil/env.go b/internal/zenutil/env.go index ecb8288..4242b67 100644 --- a/internal/zenutil/env.go +++ b/internal/zenutil/env.go @@ -20,9 +20,6 @@ var ( DateParse = func(s string) (time.Time, error) { return time.Parse("2006-01-02", s) } ) -// Remove after 1.18. -type any = interface{} - type stringErr string func (e stringErr) Error() string { return string(e) } diff --git a/util_unix.go b/util_unix.go index 422bb7f..c14242f 100644 --- a/util_unix.go +++ b/util_unix.go @@ -96,16 +96,8 @@ func lstResult(opts options, out []byte, err error) ([]string, error) { func pwdResult(sep string, opts options, out []byte, err error) (string, string, error) { str, err := strResult(opts, out, err) if opts.username { - usr, pwd, _ := cut(str, sep) + usr, pwd, _ := strings.Cut(str, sep) return usr, pwd, err } return "", str, err } - -// Replace with strings.Cut after 1.18. -func cut(s, sep string) (before, after string, found bool) { - if i := strings.Index(s, sep); i >= 0 { - return s[:i], s[i+len(sep):], true - } - return s, "", false -} diff --git a/zenity.go b/zenity.go index 3c3c808..d6d0aab 100644 --- a/zenity.go +++ b/zenity.go @@ -18,9 +18,6 @@ import ( "github.com/ncruces/zenity/internal/zenutil" ) -// Remove after 1.18. -type any = interface{} - func stringPtr(s string) *string { return &s } // ErrCanceled is returned when the cancel button is pressed,