Skip to content

Commit

Permalink
Fix windows and unsupported platform builds with dummy values (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and kuba-- committed Mar 26, 2019
1 parent 7782c2d commit dd870b5
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ go:
os:
- linux
- osx
- windows

before_install:
- go version
Expand All @@ -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)
60 changes: 60 additions & 0 deletions xattr_unsupported.go
Original file line number Diff line number Diff line change
@@ -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{}
}

0 comments on commit dd870b5

Please sign in to comment.