Skip to content

Commit

Permalink
Add Makefile and lint to test validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jentfoo committed Feb 14, 2024
1 parent beec89d commit 37390b4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,33 @@ name: Test

on:
push:
branches: [ "main" ]
branches: [ main ]
pull_request:
branches: [ "main" ]
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- '1.22'
- '1.21'
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
go-version: ${{ matrix.go }}

- name: Build
run: go build -v ./...
- name: Get dependencies
run:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest

- name: Test
run: go test -v ./...
run: make test

- name: Lint
run: make lint
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: default test ling

test:
go test -race -cover ./...

lint:
golangci-lint run
5 changes: 1 addition & 4 deletions ffmap/csv_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,7 @@ func decodeValue(dataType int, encodedValue string, value interface{}) error {

func isFloat32Overflow(fVal float64) bool {
f32Val := float32(fVal)
if math.IsInf(float64(f32Val), 0) {
return true
}
return false
return math.IsInf(float64(f32Val), 0)
}

func (kv *KeyValueCSV) Set(key string, value interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion ffmap/csv_map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ func TestGetInvalidType(t *testing.T) {
require.NoError(t, m.Set(key, value))
}

for key, _ := range testData {
for key := range testData {
for mismatchKey, mismatchValue := range testData {
if key == mismatchKey {
continue
Expand Down

0 comments on commit 37390b4

Please sign in to comment.