Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,32 @@ jobs:
strategy:
matrix:
go-version:
- '1.18' # oldest supported; named in go.mod
- '1.23' # named in go.mod
- 'oldstable'
- 'stable'
env:
TEST_RESULTS: "/tmp/test-results"
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
- name: Checkout Code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Setup go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0

- run: make test
- name: Run test
run: make test
- name: Unit test coverage
run: make coverage
- name: Upload coverage report
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
path: /tmp/coverage.out
name: Coverage-report-${{ matrix.go-version }}
- name: Display coverage report
run: go tool cover -func=/tmp/coverage.out
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.23
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
linters:
enable:
- errcheck
output_format: colored-line-number
39 changes: 19 additions & 20 deletions common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package bexpr

import (
"flag"
"reflect"
)

var benchFull *bool = flag.Bool("bench-full", false, "Run all benchmarks rather than a subset")
Expand Down Expand Up @@ -53,25 +52,25 @@ type (
)

type testFlatStructAlt struct {
Int CustomInt
Int8 CustomInt8
Int16 CustomInt16
Int32 CustomInt32
Int64 CustomInt64
Uint CustomUint
Uint8 CustomUint8
Uint16 CustomUint16
Uint32 CustomUint32
Uint64 CustomUint64
Float32 CustomFloat32
Float64 CustomFloat64
Bool CustomBool
String CustomString
unexported CustomString
Hidden CustomBool `bexpr:"-"`
Int CustomInt
Int8 CustomInt8
Int16 CustomInt16
Int32 CustomInt32
Int64 CustomInt64
Uint CustomUint
Uint8 CustomUint8
Uint16 CustomUint16
Uint32 CustomUint32
Uint64 CustomUint64
Float32 CustomFloat32
Float64 CustomFloat64
Bool CustomBool
String CustomString
//unexported CustomString
Comment thread
pkazmierczak marked this conversation as resolved.
Outdated
Hidden CustomBool `bexpr:"-"`
}

var testFlatStructKindMap map[string]reflect.Kind = map[string]reflect.Kind{
/*var testFlatStructKindMap map[string]reflect.Kind = map[string]reflect.Kind{
Comment thread
pkazmierczak marked this conversation as resolved.
Outdated
"Int": reflect.Int,
"Int8": reflect.Int8,
"Int16": reflect.Int16,
Expand All @@ -86,11 +85,11 @@ var testFlatStructKindMap map[string]reflect.Kind = map[string]reflect.Kind{
"Float64": reflect.Float64,
"Bool": reflect.Bool,
"String": reflect.String,
}
}*/

type testNestedLevel2_1 struct {
Foo int
bar string
//bar string
Comment thread
pkazmierczak marked this conversation as resolved.
Outdated
Baz string
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hashicorp/go-bexpr

go 1.18
go 1.23

require (
github.com/mitchellh/pointerstructure v1.2.1
Expand Down