Skip to content

Commit

Permalink
gofmt issue fixes as per goreportcard (#1274) (#1749)
Browse files Browse the repository at this point in the history
Fix the go formatting issues reported by gojp/goreportcardare.
Add 'gofmt' in golint.sh to warn for future commits.

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>

Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Bhargav-InfraCloud and mergify[bot] committed Nov 29, 2022
1 parent 3c589fb commit 964a950
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 139 deletions.
7 changes: 7 additions & 0 deletions build/golint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ echo "Running golangci-lint..."

golangci-lint run --timeout ${TIMEOUT} --skip-dirs ${SKIP_DIR_REGEX} -E maligned,whitespace,gocognit,unparam -e '`ctx` is unused'

# gofmt should run everywhere, including
# 1. Skipped directories in previous step
# 2. Build exempted files using build tags
# Note: Future build tags should be included.
echo "Running gofmt..."
golangci-lint run --timeout ${TIMEOUT} --disable-all --enable gofmt --build-tags integration

echo "PASS"
echo

Expand Down
26 changes: 13 additions & 13 deletions pkg/app/bp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ var _ = Suite(&BlueprintSuite{})
func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
for _, bp := range []*crv1alpha1.Blueprint{
// BP with no phase with image arg
&crv1alpha1.Blueprint{
{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-blueprint-",
},
Actions: map[string]*crv1alpha1.BlueprintAction{
"test": &crv1alpha1.BlueprintAction{
"test": {
Kind: "Deployment",
Phases: []crv1alpha1.BlueprintPhase{
crv1alpha1.BlueprintPhase{
{
Func: function.KubeExecFuncName,
Name: "test-kube-exec",
Args: map[string]interface{}{
Expand All @@ -60,15 +60,15 @@ func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
},

// BP with multiple phases with image arg
&crv1alpha1.Blueprint{
{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-blueprint-",
},
Actions: map[string]*crv1alpha1.BlueprintAction{
"test": &crv1alpha1.BlueprintAction{
"test": {
Kind: "Deployment",
Phases: []crv1alpha1.BlueprintPhase{
crv1alpha1.BlueprintPhase{
{
Func: function.KubeTaskFuncName,
Name: "test-kube-task",
Args: map[string]interface{}{
Expand All @@ -77,7 +77,7 @@ func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
"command": []string{"echo", "hello"},
},
},
crv1alpha1.BlueprintPhase{
{
Func: function.KubeTaskFuncName,
Name: "test-kube-task2",
Args: map[string]interface{}{
Expand All @@ -91,15 +91,15 @@ func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
},

// BP with multiple actions
&crv1alpha1.Blueprint{
{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "test-blueprint-",
},
Actions: map[string]*crv1alpha1.BlueprintAction{
"test": &crv1alpha1.BlueprintAction{
"test": {
Kind: "Deployment",
Phases: []crv1alpha1.BlueprintPhase{
crv1alpha1.BlueprintPhase{
{
Func: function.KubeTaskFuncName,
Name: "test-kube-task",
Args: map[string]interface{}{
Expand All @@ -108,7 +108,7 @@ func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
"command": []string{"echo", "hello"},
},
},
crv1alpha1.BlueprintPhase{
{
Func: function.KubeTaskFuncName,
Name: "test-kube-task2",
Args: map[string]interface{}{
Expand All @@ -118,9 +118,9 @@ func (bs *BlueprintSuite) TestUpdateImageTags(c *C) {
},
},
},
"test2": &crv1alpha1.BlueprintAction{
"test2": {
Phases: []crv1alpha1.BlueprintPhase{
crv1alpha1.BlueprintPhase{
{
Func: function.PrepareDataFuncName,
Name: "test-prepare-data",
Args: map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (esi *ElasticsearchInstance) Uninstall(ctx context.Context) error {

func (esi *ElasticsearchInstance) Secrets() map[string]crv1alpha1.ObjectReference {
return map[string]crv1alpha1.ObjectReference{
"elasticsearch": crv1alpha1.ObjectReference{
"elasticsearch": {
Kind: "Secret",
Name: esi.chart.Chart + "-master-credentials",
Namespace: esi.namespace,
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (mdb *MysqlDB) ConfigMaps() map[string]crv1alpha1.ObjectReference {

func (mdb *MysqlDB) Secrets() map[string]crv1alpha1.ObjectReference {
return map[string]crv1alpha1.ObjectReference{
"mysql": crv1alpha1.ObjectReference{
"mysql": {
Kind: "Secret",
Name: mdb.chart.Release,
Namespace: mdb.namespace,
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (pdb PostgresDB) ConfigMaps() map[string]crv1alpha1.ObjectReference {

func (pdb PostgresDB) Secrets() map[string]crv1alpha1.ObjectReference {
return map[string]crv1alpha1.ObjectReference{
"postgresql": crv1alpha1.ObjectReference{
"postgresql": {
Kind: "secret",
Name: pdb.getStatefulSetName(),
Namespace: pdb.namespace,
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/rds_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (pdb RDSPostgresDB) Initialize(ctx context.Context) error {

func (pdb RDSPostgresDB) ConfigMaps() map[string]crv1alpha1.ObjectReference {
return map[string]crv1alpha1.ObjectReference{
"dbconfig": crv1alpha1.ObjectReference{
"dbconfig": {
Kind: "configmap",
Name: pdb.configMapName,
Namespace: pdb.namespace,
Expand All @@ -328,7 +328,7 @@ func (pdb RDSPostgresDB) ConfigMaps() map[string]crv1alpha1.ObjectReference {

func (pdb RDSPostgresDB) Secrets() map[string]crv1alpha1.ObjectReference {
return map[string]crv1alpha1.ObjectReference{
"dbsecret": crv1alpha1.ObjectReference{
"dbsecret": {
Kind: "secret",
Name: pdb.secretName,
Namespace: pdb.namespace,
Expand Down
Loading

0 comments on commit 964a950

Please sign in to comment.