From dd870b5cfebab49617ea0c1da6176474e8a52bf4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 26 Mar 2019 12:18:52 -0700 Subject: [PATCH] Fix windows and unsupported platform builds with dummy values (#40) --- .travis.sh | 3 +++ .travis.yml | 4 ++- xattr_unsupported.go | 60 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 xattr_unsupported.go diff --git a/.travis.sh b/.travis.sh index fc86c4b..4241b61 100755 --- a/.travis.sh +++ b/.travis.sh @@ -9,6 +9,9 @@ GOOS=darwin go build echo "Building for FreeBSD..." GOOS=freebsd go build +echo "Building for Windows...(dummy)" +GOOS=windows go build + echo "Running tests..." go vet go test -v -race -coverprofile=coverage.txt -covermode=atomic diff --git a/.travis.yml b/.travis.yml index b7a4eff..0223e21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ go: os: - linux - osx + - windows before_install: - go version @@ -18,7 +19,8 @@ install: script: - ./.travis.sh - - diff <(goimports -d .) <(printf "") + # goimports on windows gives false positives + - if [[ "${TRAVIS_OS_NAME}" != "windows" ]]; then diff <(goimports -d .) <(printf ""); fi after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/xattr_unsupported.go b/xattr_unsupported.go new file mode 100644 index 0000000..305aefd --- /dev/null +++ b/xattr_unsupported.go @@ -0,0 +1,60 @@ +// +build !linux,!freebsd,!netbsd,!darwin + +package xattr + +import ( + "os" +) + +func getxattr(path string, name string, data []byte) (int, error) { + return 0, nil +} + +func lgetxattr(path string, name string, data []byte) (int, error) { + return 0, nil +} + +func fgetxattr(f *os.File, name string, data []byte) (int, error) { + return 0, nil +} + +func setxattr(path string, name string, data []byte, flags int) error { + return nil +} + +func lsetxattr(path string, name string, data []byte, flags int) error { + return nil +} + +func fsetxattr(f *os.File, name string, data []byte, flags int) error { + return nil +} + +func removexattr(path string, name string) error { + return nil +} + +func lremovexattr(path string, name string) error { + return nil +} + +func fremovexattr(f *os.File, name string) error { + return nil +} + +func listxattr(path string, data []byte) (int, error) { + return 0, nil +} + +func llistxattr(path string, data []byte) (int, error) { + return 0, nil +} + +func flistxattr(f *os.File, data []byte) (int, error) { + return 0, nil +} + +// dummy +func stringsFromByteSlice(buf []byte) (result []string) { + return []string{} +}