Skip to content

Commit

Permalink
Delete vendored code and update CI to Go 1.13 (#158)
Browse files Browse the repository at this point in the history
As the Go community transitions to using the modules ecosystem,
we want to only support one way of managing dependencies.
So this change moves to only using Go modules for dependency management.

This means that our effective minimum Go version increases to Go 1.11.
To account for this, we also update:
  - the documentation
  - Makefile
  - CI scripts
  • Loading branch information
josephlr committed Oct 26, 2019
1 parent 5d888ac commit b24e4cc
Show file tree
Hide file tree
Showing 360 changed files with 22 additions and 202,622 deletions.
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
sudo: false
dist: bionic
go: 1.12.x
go: 1.13.x

notifications:
email: false
Expand All @@ -21,7 +21,7 @@ jobs:
script: make

- stage: presubmits
env: Generate, Format, and Lint
name: Generate, Format, and Lint
install:
- make tools
script:
Expand All @@ -32,16 +32,19 @@ jobs:
- make lint

- &build
env: Build and Unit Tests
name: Build and Unit Tests
install: skip
script:
- go build github.com/google/fscrypt/cmd/fscrypt
- go get github.com/google/fscrypt/cmd/fscrypt
- make

- <<: *build
go: 1.12.x

- <<: *build
go: 1.11.x

- env: Integration Tests
- name: Integration Tests
sudo: required
addons:
apt:
Expand All @@ -57,7 +60,7 @@ jobs:
- goveralls -coverprofile=coverage.out -service=travis-ci

- stage: deploy
env: Release Binaries
name: Release Binaries
install: skip
script: skip
before_deploy: make
Expand Down
19 changes: 7 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ checks you should make sure that in your submission:
- If you made any changes to files ending in `.proto`, the corresponding
`.pb.go` files should be regenerated with `make gen`.
- Any issues found by `make lint` have been addressed.
- If any dependencies have changed, run `go mod tidy` and `go mod vendor`.
- If any dependencies have changed, run `go mod tidy`.
- `make coverage.out` can be used to generate a coverage report for all of the
tests, but isn't required for submission
(ideally most code would be tested, we are far from that ideal).
Expand All @@ -75,7 +75,6 @@ make test-setup
make all
make test-teardown
go mod tidy
go mod vendor
```
and everything succeeds, and no files are changed, you're good to submit.

Expand Down Expand Up @@ -114,11 +113,9 @@ test filesystem.

### Changing dependencies

fscrypt's dependencies are managed using the [Go 1.11 module system](https://github.com/golang/go/wiki/Modules).
If you add or remove a dependency, be sure to update `go.mod`, `go.sum`, and the
`vendor/` directory by running `go mod tidy` and `go mod vendor`. fscrypt still
vendor's it's dependencies for compatibility with older users, but this will
probobly be removed once the module system becomes widespread.
fscrypt's dependencies are managed using the
[Go module system](https://github.com/golang/go/wiki/Modules).
If you add or remove a dependency, be sure to update `go.mod` and `go.sum`.

Also, when adding a dependency, the license of the package must be compatible
with [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0). See the
Expand All @@ -139,17 +136,15 @@ your code.
- Downloads [`protoc`](https://github.com/google/protobuf) to compile the
`.proto` files.
- Turns each `.proto` file into a matching `.pb.go` file using
[`protoc-gen-go`](https://github.com/golang/protobuf/tree/master/protoc-gen-go)
(built from source in `vendor/`).
[`protoc-gen-go`](https://github.com/golang/protobuf/tree/master/protoc-gen-go).

`make format` runs:
- [`goimports`](https://godoc.org/golang.org/x/tools/cmd/goimports)
(built from source in `vendor/`) on the `.go` files.
on the `.go` files.
- [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html)
on the `.c` and `.h` files.

`make lint` runs:
- [`go vet`](https://golang.org/cmd/vet/)
- [`golint`](https://github.com/golang/lint) (built from source in `vendor/`)
- [`golint`](https://github.com/golang/lint)
- [`staticcheck`](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck)
(built from source in `vendor/`)
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ DATE_FLAG := -X "main.buildTime=$(shell date)"

override GO_LINK_FLAGS += $(VERSION_FLAG) $(DATE_FLAG) -extldflags "$(LDFLAGS)"
override GO_FLAGS += --ldflags '$(GO_LINK_FLAGS)'
# Always use Go modules
export GO111MODULE = on

###### Find All Files and Directories ######
FILES := $(shell find . \( -path ./vendor -o -path "./.*" \) -prune -o -type f -printf "%P\n")
FILES := $(shell find . -path '*/.git*' -prune -o -type f -printf "%P\n")
GO_FILES := $(filter %.go,$(FILES))
GO_NONGEN_FILES := $(filter-out %.pb.go,$(GO_FILES))
GO_DIRS := $(sort $(dir $(GO_FILES)))
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ information about each of the commands.
## Building and Installing

fscrypt has a minimal set of build dependencies:
* [Go](https://golang.org/doc/install) 1.10 or higher
* [Go](https://golang.org/doc/install) 1.11 or higher. Older versions may work
but they are not tested or supported.
* A C compiler (`gcc` or `clang`)
* `make`
* Headers for [`libpam`](http://www.linux-pam.org/).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/google/fscrypt

go 1.12
go 1.11

require (
github.com/golang/protobuf v1.2.0
Expand Down
3 changes: 0 additions & 3 deletions vendor/github.com/golang/protobuf/AUTHORS

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/github.com/golang/protobuf/CONTRIBUTORS

This file was deleted.

28 changes: 0 additions & 28 deletions vendor/github.com/golang/protobuf/LICENSE

This file was deleted.

Loading

0 comments on commit b24e4cc

Please sign in to comment.