diff --git a/.github/workflows/ci-go-cover.yml b/.github/workflows/ci-go-cover.yml index 9dce92ca..9388496e 100644 --- a/.github/workflows/ci-go-cover.yml +++ b/.github/workflows/ci-go-cover.yml @@ -24,9 +24,9 @@ jobs: name: Coverage runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: - go-version: "1.19" + go-version: "1.20" - name: Checkout code uses: actions/checkout@v2 - name: Install mockgen diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be89239a..6ba6e5f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ name: ci on: [push, pull_request] jobs: - # Test on various OS with default Go version. + # Test on various OS with the specified Go version. tests: name: Test on ${{matrix.os}} runs-on: ${{ matrix.os }} @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.19" + go-version: "1.20" - name: Checkout code uses: actions/checkout@v2 with: diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 92368c61..ef5f1086 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -3,20 +3,20 @@ name: linters on: [push, pull_request] jobs: - # Check linters on latest-ubuntu with default version of Go. + # Check linters on latest-ubuntu with specified version of Go. lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: - go-version: "1.19" + go-version: "1.20" - name: Checkout code uses: actions/checkout@v2 - name: Install golangci-lint run: | go version - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.2 - name: Install mockgen run: | go install github.com/golang/mock/mockgen@v1.5.0 diff --git a/cocli/cmd/comidCreate.go b/cocli/cmd/comidCreate.go index bc70c0cc..dc647451 100644 --- a/cocli/cmd/comidCreate.go +++ b/cocli/cmd/comidCreate.go @@ -42,7 +42,7 @@ func NewComidCreateCmd() *cobra.Command { file name, all the template file names (when from different directories) MUST be different. `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkComidCreateArgs(); err != nil { return err } diff --git a/cocli/cmd/comidDisplay.go b/cocli/cmd/comidDisplay.go index 8938c2bc..1dfc4366 100644 --- a/cocli/cmd/comidDisplay.go +++ b/cocli/cmd/comidDisplay.go @@ -35,7 +35,7 @@ func NewComidDisplayCmd() *cobra.Command { cocli comid display --file=c1.cbor --file=c2.cbor --dir=comids `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkComidDisplayArgs(); err != nil { return err } diff --git a/cocli/cmd/comidValidate.go b/cocli/cmd/comidValidate.go index 5fe7ff1f..d4aa2673 100644 --- a/cocli/cmd/comidValidate.go +++ b/cocli/cmd/comidValidate.go @@ -35,7 +35,7 @@ func NewComidValidateCmd() *cobra.Command { cocli comid validate --file=c1.cbor --file=c2.cbor --dir=comids `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkComidValidateArgs(); err != nil { return err } diff --git a/cocli/cmd/corimCreate.go b/cocli/cmd/corimCreate.go index d4206464..663a20ee 100644 --- a/cocli/cmd/corimCreate.go +++ b/cocli/cmd/corimCreate.go @@ -54,7 +54,7 @@ func NewCorimCreateCmd() *cobra.Command { --output=corim.cbor `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCorimCreateArgs(); err != nil { return err } diff --git a/cocli/cmd/corimDisplay.go b/cocli/cmd/corimDisplay.go index dfc9dcf2..e7af8a3d 100644 --- a/cocli/cmd/corimDisplay.go +++ b/cocli/cmd/corimDisplay.go @@ -38,7 +38,7 @@ func NewCorimDisplayCmd() *cobra.Command { cocli corim display --file yet-another-signed-corim.cbor --show-tags `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCorimDisplayArgs(); err != nil { return err } diff --git a/cocli/cmd/corimExtract.go b/cocli/cmd/corimExtract.go index 80d39fd5..6bf9507a 100644 --- a/cocli/cmd/corimExtract.go +++ b/cocli/cmd/corimExtract.go @@ -40,7 +40,7 @@ func NewCorimExtractCmd() *cobra.Command { --output-dir=my-dir `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCorimExtractArgs(); err != nil { return err } diff --git a/cocli/cmd/corimSign.go b/cocli/cmd/corimSign.go index bf9bb8b2..b5fec22a 100644 --- a/cocli/cmd/corimSign.go +++ b/cocli/cmd/corimSign.go @@ -38,7 +38,7 @@ func NewCorimSignCmd() *cobra.Command { --output=signed-corim.cbor `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCorimSignArgs(); err != nil { return err } diff --git a/cocli/cmd/corimSubmit.go b/cocli/cmd/corimSubmit.go index 80c1bd3a..13a3221c 100644 --- a/cocli/cmd/corimSubmit.go +++ b/cocli/cmd/corimSubmit.go @@ -46,7 +46,7 @@ func NewCorimSubmitCmd(submitter ISubmitter) *cobra.Command { --media-type="application/corim-unsigned+cbor; profile=http://arm.com/psa/iot/1" `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkSubmitArgs(); err != nil { return err diff --git a/cocli/cmd/corimVerify.go b/cocli/cmd/corimVerify.go index 6c5043d3..f68d9a7c 100644 --- a/cocli/cmd/corimVerify.go +++ b/cocli/cmd/corimVerify.go @@ -32,7 +32,7 @@ func NewCorimVerifyCmd() *cobra.Command { cocli corim verify --file=signed-corim.cbor --key=key.jwk `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCorimVerifyArgs(); err != nil { return err } diff --git a/cocli/cmd/cotsCreate.go b/cocli/cmd/cotsCreate.go index af44bca9..0546bbad 100644 --- a/cocli/cmd/cotsCreate.go +++ b/cocli/cmd/cotsCreate.go @@ -66,7 +66,7 @@ func NewCotsCreateCtsCmd() *cobra.Command { --output=cots.cbor `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkctsCreateCtsArgs(); err != nil { return err } diff --git a/cocli/cmd/cotsDisplay.go b/cocli/cmd/cotsDisplay.go index 5a198715..d3a2f97f 100644 --- a/cocli/cmd/cotsDisplay.go +++ b/cocli/cmd/cotsDisplay.go @@ -31,7 +31,7 @@ func NewCotsDisplayCmd() *cobra.Command { `, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { if err := checkCotsDisplayArgs(); err != nil { return err } diff --git a/comid/classid_test.go b/comid/classid_test.go index 28a9ce38..438a8ff6 100644 --- a/comid/classid_test.go +++ b/comid/classid_test.go @@ -373,7 +373,7 @@ func Test_TaggedInt(t *testing.T) { type testClassID [4]byte -func newTestClassID(val any) (*ClassID, error) { +func newTestClassID(_ any) (*ClassID, error) { return &ClassID{&testClassID{0x74, 0x65, 0x73, 0x74}}, nil } diff --git a/comid/cryptokey_test.go b/comid/cryptokey_test.go index 8a53edeb..a3e105d7 100644 --- a/comid/cryptokey_test.go +++ b/comid/cryptokey_test.go @@ -403,7 +403,7 @@ func Test_NewCryptoKey_negative(t *testing.T) { type testCryptoKey [4]byte -func newTestCryptoKey(val any) (*CryptoKey, error) { +func newTestCryptoKey(_ any) (*CryptoKey, error) { return &CryptoKey{&testCryptoKey{0x74, 0x64, 0x73, 0x74}}, nil } diff --git a/comid/entity_test.go b/comid/entity_test.go index d634a2f4..392a8c45 100644 --- a/comid/entity_test.go +++ b/comid/entity_test.go @@ -119,7 +119,7 @@ type testEntityNameBadType struct { testEntityName } -func newTestEntityNameBadType(val any) (*EntityName, error) { +func newTestEntityNameBadType(_ any) (*EntityName, error) { v := testEntityNameBadType{testEntityName(7)} return &EntityName{&v}, nil } diff --git a/comid/extensions_test.go b/comid/extensions_test.go index 2d96f709..9c09e4ed 100644 --- a/comid/extensions_test.go +++ b/comid/extensions_test.go @@ -13,23 +13,23 @@ type TestExtension struct { TestFlag *bool } -func (o *TestExtension) ConstrainComid(v *Comid) error { +func (o *TestExtension) ConstrainComid(_ *Comid) error { return errors.New("invalid") } -func (o *TestExtension) ValidTriples(v *Triples) error { +func (o *TestExtension) ValidTriples(_ *Triples) error { return errors.New("invalid") } -func (o *TestExtension) ConstrainMval(v *Mval) error { +func (o *TestExtension) ConstrainMval(_ *Mval) error { return errors.New("invalid") } -func (o *TestExtension) ConstrainFlagsMap(v *FlagsMap) error { +func (o *TestExtension) ConstrainFlagsMap(_ *FlagsMap) error { return errors.New("invalid") } -func (o *TestExtension) ConstrainEntity(v *Entity) error { +func (o *TestExtension) ConstrainEntity(_ *Entity) error { return errors.New("invalid") } diff --git a/comid/group_test.go b/comid/group_test.go index e415bccc..1ba7380d 100644 --- a/comid/group_test.go +++ b/comid/group_test.go @@ -11,7 +11,7 @@ import ( type testGroup uint64 -func newTestGroup(val any) (*Group, error) { +func newTestGroup(_ any) (*Group, error) { v := testGroup(7) return &Group{&v}, nil } @@ -37,7 +37,7 @@ type testGroupBadType struct { testGroup } -func newTestGroupBadType(val any) (*Group, error) { +func newTestGroupBadType(_ any) (*Group, error) { v := testGroupBadType{testGroup(7)} return &Group{&v}, nil } diff --git a/comid/instance_test.go b/comid/instance_test.go index 37cafcbd..bbf75548 100644 --- a/comid/instance_test.go +++ b/comid/instance_test.go @@ -44,7 +44,7 @@ func TestInstance_SetGetUEID_OK(t *testing.T) { type testInstance string -func newTestInstance(val any) (*Instance, error) { +func newTestInstance(_ any) (*Instance, error) { ret := testInstance("test") return &Instance{&ret}, nil } diff --git a/comid/measurement.go b/comid/measurement.go index 882f618a..9486c9a0 100644 --- a/comid/measurement.go +++ b/comid/measurement.go @@ -27,7 +27,7 @@ type Mkey struct { } // NewMkey creates a new Mkey of the specfied type using the provided value. -func NewMkey(val any, typ string) (*Mkey, error) { +func NewMkey(_ any, typ string) (*Mkey, error) { factory, ok := mkeyValueRegister[typ] if !ok { return nil, fmt.Errorf("unexpected measurement key type: %q", typ) diff --git a/comid/measurement_test.go b/comid/measurement_test.go index fe87223a..6f03500f 100644 --- a/comid/measurement_test.go +++ b/comid/measurement_test.go @@ -524,7 +524,7 @@ func TestNewMkeyOID(t *testing.T) { type testMkey [4]byte -func newTestMkey(val any) (*Mkey, error) { +func newTestMkey(_ any) (*Mkey, error) { return &Mkey{&testMkey{0x74, 0x64, 0x73, 0x74}}, nil } @@ -552,7 +552,7 @@ func (o badMkey) Type() string { return "uuid" } -func newBadMkey(val any) (*Mkey, error) { +func newBadMkey(_ any) (*Mkey, error) { return &Mkey{&badMkey{testMkey{0x74, 0x64, 0x73, 0x74}}}, nil } diff --git a/comid/svn_test.go b/comid/svn_test.go index 0ffb8f28..a1b41312 100644 --- a/comid/svn_test.go +++ b/comid/svn_test.go @@ -139,7 +139,7 @@ func TestSVN_JSON(t *testing.T) { type testSVN uint64 -func newTestSVN(val any) (*SVN, error) { +func newTestSVN(_ any) (*SVN, error) { v := testSVN(7) return &SVN{&v}, nil } @@ -160,7 +160,7 @@ type testSVNBadType struct { testSVN } -func newTestSVNBadType(val any) (*SVN, error) { +func newTestSVNBadType(_ any) (*SVN, error) { v := testSVNBadType{testSVN(7)} return &SVN{&v}, nil } diff --git a/comid/test_vars.go b/comid/test_vars.go index 7c5969e7..cfc8a46e 100644 --- a/comid/test_vars.go +++ b/comid/test_vars.go @@ -36,6 +36,7 @@ var ( TestMKey uint64 = 700 TestCCALabel = "cca-platform-config" + // #nosec G101 TestECPrivKey = `-----BEGIN EC PRIVATE KEY----- MHcCAQEEICAm3+mCCDTMuzKqfZso9NT8ur9U9GjuUQ/lNEJvwRFMoAoGCCqGSM49 AwEHoUQDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8BlLT4MFHOaO+ICTtIvrEeEpr/ diff --git a/corim/entity_test.go b/corim/entity_test.go index aec1be92..a3b371d0 100644 --- a/corim/entity_test.go +++ b/corim/entity_test.go @@ -128,7 +128,7 @@ type testEntityNameBadType struct { testEntityName } -func newTestEntityNameBadType(val any) (*EntityName, error) { +func newTestEntityNameBadType(_ any) (*EntityName, error) { v := testEntityNameBadType{testEntityName(7)} return &EntityName{&v}, nil } diff --git a/corim/extensions_test.go b/corim/extensions_test.go index 043d9a52..117fbea1 100644 --- a/corim/extensions_test.go +++ b/corim/extensions_test.go @@ -24,11 +24,11 @@ func (o TestExtensions) ConstrainEntity(ent *Entity) error { return nil } -func (o TestExtensions) ConstrainCorim(c *UnsignedCorim) error { +func (o TestExtensions) ConstrainCorim(_ *UnsignedCorim) error { return errors.New("invalid") } -func (o TestExtensions) ConstrainSigner(s *Signer) error { +func (o TestExtensions) ConstrainSigner(_ *Signer) error { return errors.New("invalid") } diff --git a/go.mod b/go.mod index 80623b50..24be7bf1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/veraison/corim -go 1.18 +go 1.20 require ( github.com/fxamacker/cbor/v2 v2.5.0