Skip to content

Commit

Permalink
Add bindata verify check and fix missing bindata changes (#2208)
Browse files Browse the repository at this point in the history
Add script to verify if bindata is up to date.
Add changes in #2205 to bindata and reformat bindata file to the format that go-bindata generated.
  • Loading branch information
oilbeater authored and aledbf committed Mar 19, 2018
1 parent 1df421a commit 28e6f54
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- sudo luarocks install luacheck
- make luacheck
- go get github.com/golang/lint/golint
- go get -u github.com/jteeuwen/go-bindata/...
- make verify-all
- stage: Coverage
before_script:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ clean:

.PHONE: code-generator
code-generator:
go-bindata -o internal/file/bindata.go -prefix="rootfs" -pkg=file -ignore=Dockerfile -ignore=".DS_Store" rootfs/...
go-bindata -nometadata -o internal/file/bindata.go -prefix="rootfs" -pkg=file -ignore=Dockerfile -ignore=".DS_Store" rootfs/...

.PHONY: build
build: clean
Expand Down
40 changes: 40 additions & 0 deletions hack/verify-bindata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

TMP_DIR="_tmp"

cleanup() {
rm -rf "${TMP_DIR}"
}
trap "cleanup" EXIT SIGINT

cleanup

go-bindata -nometadata -o ${TMP_DIR}/bindata.go -prefix="rootfs" -pkg=file -ignore=Dockerfile -ignore=".DS_Store" rootfs/...

ret=0
diff -Naupr "${TMP_DIR}/bindata.go" "internal/file/bindata.go" || ret=$?
if [[ ${ret} -eq 0 ]]
then
echo "bindata.go up to date."
else
echo "bindata.go is out of date. Please run make code-generator and NOT gofmt internal/file/bindata.go"
exit 1
fi
18 changes: 9 additions & 9 deletions internal/file/bindata.go

Large diffs are not rendered by default.

0 comments on commit 28e6f54

Please sign in to comment.