Skip to content

Commit 4dcdd4f

Browse files
authored
Bug fix for v0.2.0 (#229)
* bug: fix repo owner lower/upper case issue for repo scaffolding for github golang * chore: add more debug log
1 parent 3ca3704 commit 4dcdd4f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

docs/plugins/github-repo-scaffolding-golang_plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tools:
2121
version: 0.0.1
2222
# options for the plugin
2323
options:
24-
# the repo's owner
24+
# the repo's owner. please use lowercase
2525
owner: daniel-hutao
2626
# the repo which you'd like to create
2727
repo: golang-demo

internal/pkg/plugin/reposcaffolding/github/golang/golang.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func replaceAppNameInPathStr(filePath, appName string) (string, error) {
182182

183183
func buildState(param *Param) map[string]interface{} {
184184
res := make(map[string]interface{})
185-
res["owner"] = param.Owner
185+
res["owner"] = strings.ToLower(param.Owner)
186186
res["repoName"] = param.Repo
187187
return res
188188
}

internal/pkg/plugin/reposcaffolding/github/golang/read.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package golang
22

33
import (
44
"fmt"
5+
"strings"
56

67
"github.com/mitchellh/mapstructure"
78

@@ -44,7 +45,7 @@ func buildReadState(param *Param) (map[string]interface{}, error) {
4445
}
4546

4647
res := make(map[string]interface{})
47-
res["owner"] = *repo.Owner.Login
48+
res["owner"] = strings.ToLower(*repo.Owner.Login)
4849
res["repoName"] = *repo.Name
4950

5051
return res, nil

internal/pkg/pluginengine/change_helper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ func generateAction(tool *configloader.Tool, action statemanager.ComponentAction
2929
}
3030

3131
func drifted(a, b map[string]interface{}) bool {
32-
log.Debugf("a: %v.", a)
33-
log.Debugf("b: %v.", b)
34-
3532
// nil vs empty map
3633
if cmp.Equal(a, b, cmpopts.EquateEmpty()) {
3734
return false
@@ -56,6 +53,7 @@ func changesForApply(smgr statemanager.Manager, cfg *configloader.Config) ([]*Ch
5653
} else {
5754
// tool found in state
5855
if drifted(tool.Options, state.Options) {
56+
log.Debugf("Tool %s %s config options drifted from state.", tool.Name, tool.Plugin.Kind)
5957
// tool's config differs from State's, Update
6058
changes = append(changes, generateUpdateAction(&tool))
6159
log.Infof("Change added: %s -> %s", tool.Name, statemanager.ActionUpdate)
@@ -73,6 +71,7 @@ func changesForApply(smgr statemanager.Manager, cfg *configloader.Config) ([]*Ch
7371
changes = append(changes, generateCreateAction(&tool))
7472
log.Infof("Change added: %s -> %s", tool.Name, statemanager.ActionCreate)
7573
} else if drifted(resource, state.Resource) {
74+
log.Debugf("Tool %s %s resource drifted from state.", tool.Name, tool.Plugin.Kind)
7675
// resource drifted from state, Update
7776
changes = append(changes, generateUpdateAction(&tool))
7877
log.Infof("Change added: %s -> %s", tool.Name, statemanager.ActionUpdate)

0 commit comments

Comments
 (0)