1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-12-21 21:36:31 +00:00

travis: add travis check

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-04-06 12:48:35 -04:00
parent b595e50fec
commit c3855dab6d
5 changed files with 27 additions and 6 deletions

20
.travis.yml Normal file
View file

@ -0,0 +1,20 @@
language: go
go:
- 1.6
- 1.5.3
sudo: false
before_install:
- git config --global url."https://".insteadOf git://
- go get golang.org/x/tools/cmd/vet
- go get -u github.com/golang/lint/golint
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/go-mtree
- go get ./...
install: true
script:
- go vet -x ./...
- golint ./...
- go test -v ./...

View file

@ -49,9 +49,9 @@ type Entry struct {
// Path provides the full path of the file, despite RelativeType or FullType
func (e Entry) Path() string {
if e.Parent == nil || e.Type == FullType {
return e.Name
return filepath.Clean(e.Name)
}
return filepath.Join(e.Parent.Path(), e.Name)
return filepath.Clean(filepath.Join(e.Parent.Path(), e.Name))
}
func (e Entry) String() string {

View file

@ -3,6 +3,7 @@ package mtree
import (
"bufio"
"io"
"path/filepath"
"strings"
)
@ -70,12 +71,12 @@ func ParseSpec(r io.Reader) (*DirectoryHierarchy, error) {
}
// parse the options
f := strings.Fields(str)
if strings.Contains(str, "/") {
e.Name = filepath.Clean(f[0])
if strings.Contains(e.Name, "/") {
e.Type = FullType
} else {
e.Type = RelativeType
}
e.Name = f[0]
e.Keywords = f[1:]
e.Parent = creator.curDir
for i := range e.Keywords {

View file

@ -42,7 +42,7 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
Pos: len(creator.DH.Entries),
})
// TODO Insert a comment of the full path of the directory's name
// Insert a comment of the full path of the directory's name
if creator.curDir != nil {
creator.DH.Entries = append(creator.DH.Entries, Entry{
Pos: len(creator.DH.Entries),

View file

@ -26,7 +26,7 @@ func TestXattr(t *testing.T) {
t.Error(fh.Name(), err)
}
if !(len(l) > 0) {
t.Errorf("%q: expected a list of at least 1; got %d", len(l))
t.Errorf("%q: expected a list of at least 1; got %d", fh.Name(), len(l))
}
got, err := Get(fh.Name(), "user.testing")
if err != nil {