From 18f32595406d43e1acb5a58f37d15329680fb3c0 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Wed, 14 Apr 2021 15:18:05 +0100 Subject: [PATCH] Go 1.16. --- cmd/zenity/main.go | 9 ++------- go.mod | 2 +- go.sum | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/zenity/main.go b/cmd/zenity/main.go index 2e5cda3..4d4e6bc 100644 --- a/cmd/zenity/main.go +++ b/cmd/zenity/main.go @@ -177,7 +177,7 @@ func setupFlags() { flag.BoolVar(&hideText, "hide-text", false, "Hide the entry text") // List options - flag.Var(funcValue(addColumn), "column", "Set the column header") + flag.Func("column", "Set the column header", addColumn) flag.Bool("hide-header", true, "Hide the column headers") flag.BoolVar(&allowEmpty, "allow-empty", true, "Allow empty selection (macOS only)") @@ -188,7 +188,7 @@ func setupFlags() { flag.BoolVar(&confirmCreate, "confirm-create", false, "Confirm file selection if filename does not yet exist (Windows only)") flag.BoolVar(&showHidden, "show-hidden", false, "Show hidden files (Windows and macOS only)") flag.StringVar(&filename, "filename", "", "Set the `filename`") - flag.Var(funcValue(addFileFilter), "file-filter", "Set a filename filter (NAME | PATTERN1 PATTERN2 ...)") + flag.Func("file-filter", "Set a filename filter (NAME | PATTERN1 PATTERN2 ...)", addFileFilter) // Color selection options flag.StringVar(&defaultColor, "color", "", "Set the `color`") @@ -520,11 +520,6 @@ func egestPaths(paths []string, err error) ([]string, error) { return paths, err } -type funcValue func(string) error - -func (f funcValue) String() string { return "" } -func (f funcValue) Set(s string) error { return f(s) } - func addColumn(s string) error { columns++ if columns <= 1 { diff --git a/go.mod b/go.mod index 7df380c..4b14294 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ncruces/zenity -go 1.15 +go 1.16 require ( github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947 diff --git a/go.sum b/go.sum index f452467..a82376e 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=