From bbdd69886977f441b57cc77a51ce6df9e938be05 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sun, 8 Sep 2019 21:55:02 -0300 Subject: [PATCH 1/2] Upgrade mvdan.cc/sh to use edge --- go.mod | 8 ++------ go.sum | 27 +++++++++++++++++---------- internal/execext/exec.go | 11 +++++------ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index b5bf4580..11bae880 100644 --- a/go.mod +++ b/go.mod @@ -8,18 +8,14 @@ require ( github.com/google/uuid v1.0.0 // indirect github.com/huandu/xstrings v1.1.0 // indirect github.com/imdario/mergo v0.3.6 // indirect - github.com/kr/pretty v0.1.0 // indirect github.com/mattn/go-zglob v0.0.1 github.com/mitchellh/go-homedir v1.0.0 github.com/radovskyb/watcher v1.0.5 github.com/spf13/pflag v1.0.3 github.com/stretchr/testify v1.3.0 - golang.org/x/crypto v0.0.0-20180830192347-182538f80094 // indirect - golang.org/x/net v0.0.0-20180826012351-8a410e7b638d // indirect - golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f - golang.org/x/sys v0.0.0-20180831094639-fa5fdf94c789 // indirect + golang.org/x/sync v0.0.0-20190423024810-112230192c58 gopkg.in/yaml.v2 v2.2.1 - mvdan.cc/sh v2.6.4+incompatible + mvdan.cc/sh/v3 v3.0.0-alpha2.0.20190908210725-4a0ebd2f3c1b ) go 1.13 diff --git a/go.sum b/go.sum index 18f0ea37..245c6c62 100644 --- a/go.sum +++ b/go.sum @@ -26,22 +26,29 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/radovskyb/watcher v1.0.5 h1:wqt7gb+HjGacvFoLTKeT44C+XVPxu7bvHvKT1IvZ7rw= github.com/radovskyb/watcher v1.0.5/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20180830192347-182538f80094 h1:rVTAlhYa4+lCfNxmAIEOGQRoD23UqP72M3+rSWVGDTg= -golang.org/x/crypto v0.0.0-20180830192347-182538f80094/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180831094639-fa5fdf94c789 h1:T8D7l6WB3tLu+VpKvw06ieD/OhBi1XpJmG1U/FtttZg= -golang.org/x/sys v0.0.0-20180831094639-fa5fdf94c789/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -mvdan.cc/sh v2.6.4+incompatible h1:eD6tDeh0pw+/TOTI1BBEryZ02rD2nMcFsgcvde7jffM= -mvdan.cc/sh v2.6.4+incompatible/go.mod h1:IeeQbZq+x2SUGBensq/jge5lLQbS3XT2ktyp3wrt4x8= +mvdan.cc/sh/v3 v3.0.0-alpha2.0.20190908210725-4a0ebd2f3c1b h1:kzTXBacNrjp7n8ncNC894X9NUeL8yeKVS5MS0bigJwE= +mvdan.cc/sh/v3 v3.0.0-alpha2.0.20190908210725-4a0ebd2f3c1b/go.mod h1:6Cd5lQRZZIHeKAdYoLvhhse0oDOIrS5gBoGacWnuiUE= diff --git a/internal/execext/exec.go b/internal/execext/exec.go index e7bbe5d7..c8f9b445 100644 --- a/internal/execext/exec.go +++ b/internal/execext/exec.go @@ -8,10 +8,10 @@ import ( "path/filepath" "strings" - "mvdan.cc/sh/expand" - "mvdan.cc/sh/interp" - "mvdan.cc/sh/shell" - "mvdan.cc/sh/syntax" + "mvdan.cc/sh/v3/expand" + "mvdan.cc/sh/v3/interp" + "mvdan.cc/sh/v3/shell" + "mvdan.cc/sh/v3/syntax" ) // RunCommandOptions is the options for the RunCommand func @@ -49,8 +49,7 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error { interp.Dir(opts.Dir), interp.Env(expand.ListEnviron(environ...)), - interp.Module(interp.DefaultExec), - interp.Module(interp.OpenDevImpls(interp.DefaultOpen)), + interp.WithOpenModules(interp.OpenDevImpls), interp.StdIO(opts.Stdin, opts.Stdout, opts.Stderr), ) From 0e1d8a72e6d00029362b8e24d35853202d86a724 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sun, 8 Sep 2019 21:56:23 -0300 Subject: [PATCH 2/2] Revert "Ensure the $HOME env is being set on Windows" This reverts commit 52028fc3bc5c9a80d3974b2f74efa491229df075. --- cmd/task/task.go | 1 - internal/homefix/homefix.go | 5 ----- internal/homefix/homefix_windows.go | 15 --------------- task_test.go | 1 - 4 files changed, 22 deletions(-) delete mode 100644 internal/homefix/homefix.go delete mode 100644 internal/homefix/homefix_windows.go diff --git a/cmd/task/task.go b/cmd/task/task.go index 2805489b..b71023ac 100644 --- a/cmd/task/task.go +++ b/cmd/task/task.go @@ -10,7 +10,6 @@ import ( "github.com/go-task/task/v2" "github.com/go-task/task/v2/internal/args" - _ "github.com/go-task/task/v2/internal/homefix" "github.com/spf13/pflag" ) diff --git a/internal/homefix/homefix.go b/internal/homefix/homefix.go deleted file mode 100644 index 641ae79a..00000000 --- a/internal/homefix/homefix.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package homefix exists to address a bug where mvdan.cc/sh expects -// $HOME to be available in order to be able to expand "~". -// -// We should delete this package once this is fixed there. -package homefix diff --git a/internal/homefix/homefix_windows.go b/internal/homefix/homefix_windows.go deleted file mode 100644 index 28ed67fc..00000000 --- a/internal/homefix/homefix_windows.go +++ /dev/null @@ -1,15 +0,0 @@ -package homefix - -import ( - "os" - - "github.com/mitchellh/go-homedir" -) - -func init() { - if os.Getenv("HOME") == "" { - if home, err := homedir.Dir(); err == nil { - os.Setenv("HOME", home) - } - } -} diff --git a/task_test.go b/task_test.go index 24862dd1..d34abf67 100644 --- a/task_test.go +++ b/task_test.go @@ -12,7 +12,6 @@ import ( "testing" "github.com/go-task/task/v2" - _ "github.com/go-task/task/v2/internal/homefix" "github.com/go-task/task/v2/internal/taskfile" "github.com/mitchellh/go-homedir"