# Copyright 2019 The Periph Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. os: linux dist: bionic language: go go_import_path: periph.io/x/periph jobs: include: - go: 1.14.x cache: directories: - $GOPATH/pkg/mod # Cache tools sources. #- $GOPATH/src/golang\.org before_script: - echo $TRAVIS_GO_VERSION - go get -t -v periph.io/x/periph/... - > go get -u -v golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow script: - > echo 'Looking for external dependencies:'; go list -f '{{join .Imports "\n"}}' periph.io/x/periph/... | sort | uniq | grep -v ^periph.io/x/periph | xargs go list -f '{{if not .Standard}}- {{.ImportPath}}{{end}}' - > echo 'Erroring on external dependencies:'; ! go list -f '{{join .Imports "\n"}}' periph.io/x/periph/... | sort | uniq | grep -v ^periph.io/x/periph | xargs go list -f '{{if not .Standard}}Remove {{.ImportPath}}{{end}}' | grep -q Remove - > echo 'Erroring on /host depending on /devices:'; ! go list -f '{{.ImportPath}} depends on {{join .Imports ", "}}' periph.io/x/periph/host/... | sort | uniq | grep periph.io/x/periph/devices - > echo 'Erroring on /conn depending on /devices:'; ! go list -f '{{.ImportPath}} depends on {{join .Imports ", "}}' periph.io/x/periph/conn/... | sort | uniq | grep periph.io/x/periph/devices - > echo 'Erroring on /conn depending on /host:'; ! go list -f '{{.ImportPath}} depends on {{join .Imports ", "}}' periph.io/x/periph/conn/... | sort | uniq | grep periph.io/x/periph/host - > echo 'Erroring on shadowed variables:'; ! go vet -vettool=$(which shadow) ./... |& grep -v '"err"' | grep -e '^[^#]'