Migrate to go module

This commit is contained in:
Max Claus Nunes 2019-11-12 18:37:44 -03:00
parent 7c57257db3
commit 0324256f9c
6 changed files with 46 additions and 110 deletions

81
Gopkg.lock generated
View File

@ -1,81 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
name = "github.com/fatih/color"
packages = ["."]
revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
version = "v1.7.0"
[[projects]]
name = "github.com/mattn/go-colorable"
packages = ["."]
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
version = "v0.0.9"
[[projects]]
name = "github.com/mattn/go-isatty"
packages = ["."]
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.3"
[[projects]]
name = "github.com/mattn/go-shellwords"
packages = ["."]
revision = "02e3cf038dcea8290e44424da473dd12be796a8a"
version = "v1.0.3"
[[projects]]
branch = "master"
name = "github.com/mattn/go-zglob"
packages = [
".",
"fastwalk"
]
revision = "49693fbb3fe3c3a75fc4e4d6fb1d7cedcbdeb385"
[[projects]]
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
name = "github.com/stretchr/objx"
packages = ["."]
revision = "477a77ecc69700c7cdeb1fa9e129548e1c1c393c"
version = "v0.1.1"
[[projects]]
name = "github.com/stretchr/testify"
packages = [
"assert",
"mock"
]
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[[projects]]
name = "github.com/urfave/cli"
packages = ["."]
revision = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1"
version = "v1.20.0"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "6c888cc515d3ed83fc103cf1d84468aad274b0a7"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "8446ff85ebcb6bc802d3f444727c3910444a405f3c073c1095eb5cc8c497138b"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,23 +0,0 @@
[[constraint]]
name = "github.com/fatih/color"
version = "1.7.0"
[[constraint]]
name = "github.com/mattn/go-shellwords"
version = "1.0.3"
[[constraint]]
name = "github.com/urfave/cli"
version = "1.20.0"
[prune]
go-tests = true
unused-packages = true
[[constraint]]
branch = "master"
name = "github.com/mattn/go-zglob"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"

View File

@ -38,13 +38,11 @@ func TestBuilderFailureBuild(t *testing.T) {
t.Fatalf("couldn't get current working directory: %v", err) t.Fatalf("couldn't get current working directory: %v", err)
} }
absPathBuild := filepath.Join(wd, dir)
b := NewBuilder(dir, bin, wd, bArgs) b := NewBuilder(dir, bin, wd, bArgs)
err = b.Build() err = b.Build()
assert.NotNil(t, err, "build error") assert.NotNil(t, err, "build error")
assert.Equal(t, err.Error(), "build failed with exit status 2\n"+ assert.Equal(t, err.Error(), "build failed with exit status 2\n"+
"# _"+absPathBuild+"\n"+ "# github.com/maxcnunes/gaper/testdata/build-failure\n"+
"./main.go:4:6: func main must have no arguments and no return values\n"+ "./main.go:4:6: func main must have no arguments and no return values\n"+
"./main.go:5:1: missing return at end of function\n") "./main.go:5:1: missing return at end of function\n")
} }

17
go.mod Normal file
View File

@ -0,0 +1,17 @@
module github.com/maxcnunes/gaper
go 1.13
require (
github.com/davecgh/go-spew v1.1.0
github.com/fatih/color v1.7.0
github.com/mattn/go-colorable v0.0.9
github.com/mattn/go-isatty v0.0.3
github.com/mattn/go-shellwords v1.0.3
github.com/mattn/go-zglob v0.0.0-20180607075734-49693fbb3fe3
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/objx v0.1.1
github.com/stretchr/testify v1.2.2
github.com/urfave/cli v1.20.0
golang.org/x/sys v0.0.0-20180616030259-6c888cc515d3
)

21
go.sum Normal file
View File

@ -0,0 +1,21 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-shellwords v1.0.3 h1:K/VxK7SZ+cvuPgFSLKi5QPI9Vr/ipOf4C1gN+ntueUk=
github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=
github.com/mattn/go-zglob v0.0.0-20180607075734-49693fbb3fe3 h1:GWnsQiFbiQ7lREZbKkiJC6xxbymvny8GKtpdkPxjB6o=
github.com/mattn/go-zglob v0.0.0-20180607075734-49693fbb3fe3/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
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.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
golang.org/x/sys v0.0.0-20180616030259-6c888cc515d3/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -1,7 +1,6 @@
package gaper package gaper
import ( import (
"log"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -173,6 +172,11 @@ func TestWatcherIgnoreFile(t *testing.T) {
}, },
} }
// create vendor folder for testing
if err := os.MkdirAll("vendor", os.ModePerm); err != nil {
t.Fatal(err)
}
for _, tc := range testCases { for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
srvdir := "." srvdir := "."
@ -198,12 +202,12 @@ func TestWatcherIgnoreFile(t *testing.T) {
filePath := tc.file filePath := tc.file
file, err := os.Open(filePath) file, err := os.Open(filePath)
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
fileInfo, err := file.Stat() fileInfo, err := file.Stat()
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
assert.Equal(t, tc.expectIgnore, wt.ignoreFile(filePath, fileInfo)) assert.Equal(t, tc.expectIgnore, wt.ignoreFile(filePath, fileInfo))