diff --git a/.github/workflows/build-verify.yml b/.github/workflows/build-verify.yml index aa11852..8756d78 100644 --- a/.github/workflows/build-verify.yml +++ b/.github/workflows/build-verify.yml @@ -36,6 +36,18 @@ jobs: go-version-file: ./go.mod cache-dependency-path: ./go.sum + - name: Run unit tests + run: go test ./... + + - name: Run go vet + run: go vet ./... + + - name: Run staticcheck + uses: dominikh/staticcheck-action@v1.3.0 + with: + version: latest + install-go: false + - name: Build Go packages run: | make clean diff --git a/Makefile b/Makefile index 11f799a..e7da568 100644 --- a/Makefile +++ b/Makefile @@ -27,4 +27,12 @@ build-binaries: .PHONY: build-watcher build-watcher: - go build -o ${DIST_DIR}/${BIN_NAME}-${WATCHER_NAME} ${PACKAGE}/watcher \ No newline at end of file + go build -o ${DIST_DIR}/${BIN_NAME}-${WATCHER_NAME} ${PACKAGE}/watcher + +.PHONY: test +test: + go test ./... + +.PHONY: vet +vet: + go vet ./... \ No newline at end of file diff --git a/pkg/watcher/executor.go b/pkg/watcher/executor.go index 3347fc6..3c42fca 100644 --- a/pkg/watcher/executor.go +++ b/pkg/watcher/executor.go @@ -12,7 +12,8 @@ func TriggerImport(entry config.WatchEntry) { // Retrieve config to get client options. cfgPath, err := config.DefaultLocalConfigPath() if err != nil { - fmt.Errorf("Error while loading config: %s", err.Error()) + fmt.Printf("Error while loading config: %s\n", err.Error()) + return } fmt.Println("[INFO] Re-importing changed file: " + entry.FilePath)