diff --git a/common/config/standardvalues.go b/common/config/standardvalues.go index 7935420f09f..69b4d82db82 100644 --- a/common/config/standardvalues.go +++ b/common/config/standardvalues.go @@ -81,7 +81,7 @@ func (sv *standardValues) initializeProtosStruct(objValue reflect.Value) error { case reflect.Ptr: fieldPtr := objValue.Elem().Field(i) if !fieldPtr.CanSet() { - return fmt.Errorf("Cannot set structure field %s (unexported?)", structField) + return fmt.Errorf("Cannot set structure field %s (unexported?)", structField.Name) } fieldPtr.Set(reflect.New(structField.Type.Elem())) default: diff --git a/common/configtx/compare_test.go b/common/configtx/compare_test.go index 0e2da0a0222..11c8f6bfe8c 100644 --- a/common/configtx/compare_test.go +++ b/common/configtx/compare_test.go @@ -17,9 +17,10 @@ limitations under the License. package configtx import ( - "github.com/stretchr/testify/assert" "testing" + "github.com/stretchr/testify/assert" + cb "github.com/hyperledger/fabric/protos/common" ) diff --git a/common/configtx/configmap.go b/common/configtx/configmap.go index 68df82255bc..bdf4f8b03f1 100644 --- a/common/configtx/configmap.go +++ b/common/configtx/configmap.go @@ -122,7 +122,7 @@ func recurseConfigMap(path string, configMap map[string]comparable) (*cb.ConfigG } if group.ConfigGroup == nil { - return nil, fmt.Errorf("ConfigGroup not found at group path", groupPath) + return nil, fmt.Errorf("ConfigGroup not found at group path: %s", groupPath) } for key, _ := range group.Groups { @@ -140,7 +140,7 @@ func recurseConfigMap(path string, configMap map[string]comparable) (*cb.ConfigG return nil, fmt.Errorf("Missing value at path: %s", valuePath) } if value.ConfigValue == nil { - return nil, fmt.Errorf("ConfigValue not found at value path", valuePath) + return nil, fmt.Errorf("ConfigValue not found at value path: %s", valuePath) } group.Values[key] = value.ConfigValue } @@ -152,7 +152,7 @@ func recurseConfigMap(path string, configMap map[string]comparable) (*cb.ConfigG return nil, fmt.Errorf("Missing policy at path: %s", policyPath) } if policy.ConfigPolicy == nil { - return nil, fmt.Errorf("ConfigPolicy not found at policy path", policyPath) + return nil, fmt.Errorf("ConfigPolicy not found at policy path: %s", policyPath) } group.Policies[key] = policy.ConfigPolicy } diff --git a/common/configtx/configmap_test.go b/common/configtx/configmap_test.go index 38e81e6f5a5..d884abafc42 100644 --- a/common/configtx/configmap_test.go +++ b/common/configtx/configmap_test.go @@ -17,9 +17,10 @@ limitations under the License. package configtx import ( - "github.com/stretchr/testify/assert" "testing" + "github.com/stretchr/testify/assert" + cb "github.com/hyperledger/fabric/protos/common" ) diff --git a/common/configtx/tool/configtxgen/main.go b/common/configtx/tool/configtxgen/main.go index 881e3d2fade..24275159586 100644 --- a/common/configtx/tool/configtxgen/main.go +++ b/common/configtx/tool/configtxgen/main.go @@ -74,7 +74,7 @@ func doInspectBlock(inspectBlock string) error { block := &cb.Block{} err = proto.Unmarshal(data, block) if err != nil { - fmt.Errorf("Error unmarshaling block: %s", err) + return fmt.Errorf("Error unmarshaling block: %s", err) } ctx, err := utils.ExtractEnvelope(block, 0) diff --git a/common/mocks/policies/policies.go b/common/mocks/policies/policies.go index 75e18a34016..02a233d6646 100644 --- a/common/mocks/policies/policies.go +++ b/common/mocks/policies/policies.go @@ -76,4 +76,4 @@ func (m *Manager) GetPolicy(id string) (policies.Policy, bool) { } } return m.Policy, m.Policy != nil -} \ No newline at end of file +} diff --git a/common/policies/implicitmeta_test.go b/common/policies/implicitmeta_test.go index 649e2cca606..a6c89544772 100644 --- a/common/policies/implicitmeta_test.go +++ b/common/policies/implicitmeta_test.go @@ -34,7 +34,7 @@ func (rp acceptPolicy) Evaluate(signedData []*cb.SignedData) error { return nil } -func TestimplicitMarshalError(t *testing.T) { +func TestImplicitMarshalError(t *testing.T) { _, err := newImplicitMetaPolicy([]byte("GARBAGE")) assert.Error(t, err, "Should have errored unmarshaling garbage") } diff --git a/scripts/golinter.sh b/scripts/golinter.sh index c3a02079c68..3fe7e79c166 100755 --- a/scripts/golinter.sh +++ b/scripts/golinter.sh @@ -2,7 +2,19 @@ set -e -declare -a arr=("./core" "./events" "./examples" "./peer" "./protos" "./orderer" "./msp" "./gossip" "./bccsp") +declare -a arr=( +"./accesscontrol" +"./bccsp" +"./common" +"./core" +"./events" +"./examples" +"./gossip" +"./msp" +"./orderer" +"./peer" +"./protos" +) for i in "${arr[@]}" do