Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Fossati <[email protected]>
  • Loading branch information
thomas-fossati committed May 21, 2024
1 parent 149fc29 commit 6392e5d
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cocli/cmd/comidCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/comidDisplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/comidValidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimDisplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimExtract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimSign.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimSubmit.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/corimVerify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/cotsCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cocli/cmd/cotsDisplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion comid/classid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion comid/cryptokey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion comid/entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions comid/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
4 changes: 2 additions & 2 deletions comid/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion comid/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion comid/measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions comid/measurement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions comid/svn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions comid/test_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion corim/entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions corim/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit 6392e5d

Please sign in to comment.