Add strict build with vet, fmt, golint
This commit is contained in:
@@ -1,16 +1,34 @@
|
||||
MINIOPATH=$(GOPATH)/src/github.com/minio-io/mc
|
||||
|
||||
all: getdeps install
|
||||
|
||||
checkdeps:
|
||||
@./checkdeps.sh
|
||||
@echo "Checking deps.."
|
||||
@(env bash $(PWD)/checkdeps.sh)
|
||||
|
||||
createsymlink:
|
||||
@mkdir -p $(GOPATH)/src/github.com/minio-io/;
|
||||
@if test ! -e $(GOPATH)/src/github.com/minio-io/mc; then echo "Creating symlink to $(GOPATH)/src/github.com/minio-io/mc" && ln -s $(PWD) $(GOPATH)/src/github.com/minio-io/mc; fi
|
||||
checkgopath:
|
||||
@echo "Checking if project is at ${MINIOPATH}"
|
||||
@if [ ! -d ${MINIOPATH} ]; then echo "Project not found in $GOPATH, please follow instructions provided at https://github.com/Minio-io/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi
|
||||
|
||||
getdeps: checkdeps
|
||||
getdeps: checkdeps checkgopath
|
||||
@go get github.com/tools/godep && echo "Installed godep"
|
||||
@go get github.com/golang/lint/golint && echo "Installed golint"
|
||||
@go get golang.org/x/tools/cmd/vet && echo "Installed vet"
|
||||
|
||||
build-all: getdeps createsymlink
|
||||
verifiers: getdeps vet fmt lint
|
||||
|
||||
vet:
|
||||
@echo "Running $@"
|
||||
@go vet ./...
|
||||
fmt:
|
||||
@echo "Running $@"
|
||||
@test -z "$$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" || \
|
||||
echo "+ please format Go code with 'gofmt -s'"
|
||||
lint:
|
||||
@echo "Running $@"
|
||||
@test -z "$$(golint ./... | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
|
||||
|
||||
build-all: getdeps verifiers
|
||||
@echo "Building Libraries"
|
||||
@godep go generate ./...
|
||||
@godep go build ./...
|
||||
|
||||
@@ -35,6 +35,7 @@ limitations under the License.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package s3
|
||||
|
||||
import (
|
||||
|
||||
@@ -57,8 +57,8 @@ func TestParseBuckets(t *testing.T) {
|
||||
t.Errorf("num parsed buckets = %d; want %d", g, w)
|
||||
}
|
||||
|
||||
t1, err := time.Parse(xmlTimeFormat, "2006-06-21T07:04:31.000Z")
|
||||
t2, err := time.Parse(xmlTimeFormat, "2006-06-21T07:04:32.000Z")
|
||||
t1, err := time.Parse(iso8601Format, "2006-06-21T07:04:31.000Z")
|
||||
t2, err := time.Parse(iso8601Format, "2006-06-21T07:04:32.000Z")
|
||||
want := []*Bucket{
|
||||
{Name: "bucketOne", CreationDate: xmlTime{t1}},
|
||||
{Name: "bucketTwo", CreationDate: xmlTime{t2}},
|
||||
|
||||
@@ -35,6 +35,7 @@ limitations under the License.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package s3
|
||||
|
||||
import (
|
||||
|
||||
@@ -35,6 +35,7 @@ limitations under the License.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package s3
|
||||
|
||||
import (
|
||||
|
||||
@@ -35,6 +35,7 @@ limitations under the License.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package s3
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user