Просмотр исходного кода

Merge pull request #474 from smallstep/cgo-or-not-cgo

Permit linting and testing without CGO support.
Mariano Cano 5 лет назад
Родитель
Сommit
4745be2309
5 измененных файлов с 15 добавлено и 7 удалено
  1. 1 1
      .travis.yml
  2. 11 3
      Makefile
  3. 1 1
      kms/pkcs11/other_test.go
  4. 1 1
      kms/pkcs11/softhsm2_test.go
  5. 1 1
      kms/pkcs11/yubihsm2_test.go

+ 1 - 1
.travis.yml

@@ -18,7 +18,7 @@ env:
 before_script:
   - make bootstrap
 script:
-  - make
+  - make travis
   - make artifacts
 after_success:
   - bash <(curl -s https://codecov.io/bash) -t "$CODECOV_TOKEN" || echo "Codecov did

+ 11 - 3
Makefile

@@ -18,7 +18,9 @@ OUTPUT_ROOT=output/
 
 all: lint test build
 
-.PHONY: all
+travis: lintcgo testcgo build
+
+.PHONY: all travis
 
 #########################################
 # Bootstrapping
@@ -119,9 +121,12 @@ generate:
 # Test
 #########################################
 test:
+	$Q $(GOFLAGS) go test -short -coverprofile=coverage.out ./...
+
+testcgo:
 	$Q go test -short -coverprofile=coverage.out ./...
 
-.PHONY: test
+.PHONY: test testcgo
 
 integrate: integration
 
@@ -138,9 +143,12 @@ fmt:
 	$Q gofmt -l -w $(SRC)
 
 lint:
+	$Q $(GOFLAGS) LOG_LEVEL=error golangci-lint run --timeout=30m
+
+lintcgo:
 	$Q LOG_LEVEL=error golangci-lint run --timeout=30m
 
-.PHONY: lint fmt
+.PHONY: fmt lint lintcgo
 
 #########################################
 # Install

+ 1 - 1
kms/pkcs11/other_test.go

@@ -1,4 +1,4 @@
-// +build !softhsm2,!yubihsm2,!opensc
+// +build cgo,!softhsm2,!yubihsm2,!opensc
 
 package pkcs11
 

+ 1 - 1
kms/pkcs11/softhsm2_test.go

@@ -1,4 +1,4 @@
-// +build softhsm2
+// +build cgo,softhsm2
 
 package pkcs11
 

+ 1 - 1
kms/pkcs11/yubihsm2_test.go

@@ -1,4 +1,4 @@
-// +build yubihsm2
+// +build cgo,yubihsm2
 
 package pkcs11