Cleanup from go report card
diff --git a/README.md b/README.md
index 566bd30..fadeff8 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
installed by a tool (e.g. glide), similar to `go get` or they can be vendored and
distributed with the package.
-[](https://travis-ci.org/Masterminds/glide) [](http://goreportcard.com/report/Masterminds/glide) [](https://godoc.org/github.com/Masterminds/glide) [](http://glide.readthedocs.org/en/stable/?badge=stable) [](http://glide.readthedocs.org/en/latest/?badge=latest) [](https://gitter.im/Masterminds/glide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](https://travis-ci.org/Masterminds/glide) [](https://goreportcard.com/report/github.com/Masterminds/glide) [](https://godoc.org/github.com/Masterminds/glide) [](http://glide.readthedocs.org/en/stable/?badge=stable) [](http://glide.readthedocs.org/en/latest/?badge=latest) [](https://gitter.im/Masterminds/glide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
### Features
diff --git a/action/project_info.go b/action/project_info.go
index 5e0995e..379026e 100644
--- a/action/project_info.go
+++ b/action/project_info.go
@@ -6,13 +6,14 @@
"github.com/Masterminds/glide/msg"
)
+// Info prints information about a project based on a passed in format.
func Info(format string) {
conf := EnsureConfig()
var buffer bytes.Buffer
varInit := false
- for _, var_format := range format {
+ for _, varfmt := range format {
if varInit {
- switch var_format {
+ switch varfmt {
case 'n':
buffer.WriteString(conf.Name)
case 'd':
@@ -22,15 +23,15 @@
case 'l':
buffer.WriteString(conf.License)
default:
- msg.Die("Invalid format %s", string(var_format))
+ msg.Die("Invalid format %s", string(varfmt))
}
} else {
- switch var_format {
+ switch varfmt {
case '%':
varInit = true
continue
default:
- buffer.WriteString(string(var_format))
+ buffer.WriteString(string(varfmt))
}
}
varInit = false
diff --git a/action/rebuild.go b/action/rebuild.go
index f76d948..dffde39 100644
--- a/action/rebuild.go
+++ b/action/rebuild.go
@@ -98,4 +98,3 @@
}
return err
}
-
diff --git a/gom/parser.go b/gom/parser.go
index bf54f61..3bcd9e0 100644
--- a/gom/parser.go
+++ b/gom/parser.go
@@ -16,10 +16,10 @@
var qx = `'[^']*'|"[^"]*"`
var kx = `:[a-z][a-z0-9_]*`
var ax = `(?:\s*` + kx + `\s*|,\s*` + kx + `\s*)`
-var re_group = regexp.MustCompile(`\s*group\s+((?:` + kx + `\s*|,\s*` + kx + `\s*)*)\s*do\s*$`)
-var re_end = regexp.MustCompile(`\s*end\s*$`)
-var re_gom = regexp.MustCompile(`^\s*gom\s+(` + qx + `)\s*((?:,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*))*)$`)
-var re_options = regexp.MustCompile(`(,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*)\s*)`)
+var reGroup = regexp.MustCompile(`\s*group\s+((?:` + kx + `\s*|,\s*` + kx + `\s*)*)\s*do\s*$`)
+var reEnd = regexp.MustCompile(`\s*end\s*$`)
+var reGom = regexp.MustCompile(`^\s*gom\s+(` + qx + `)\s*((?:,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*))*)$`)
+var reOptions = regexp.MustCompile(`(,\s*` + kx + `\s*=>\s*(?:` + qx + `|\s*\[\s*` + ax + `*\s*\]\s*)\s*)`)
func unquote(name string) string {
name = strings.TrimSpace(name)
@@ -32,13 +32,13 @@
}
func parseOptions(line string, options map[string]interface{}) {
- ss := re_options.FindAllStringSubmatch(line, -1)
- re_a := regexp.MustCompile(ax)
+ ss := reOptions.FindAllStringSubmatch(line, -1)
+ reA := regexp.MustCompile(ax)
for _, s := range ss {
kvs := strings.SplitN(strings.TrimSpace(s[0])[1:], "=>", 2)
kvs[0], kvs[1] = strings.TrimSpace(kvs[0]), strings.TrimSpace(kvs[1])
if kvs[1][0] == '[' {
- as := re_a.FindAllStringSubmatch(kvs[1][1:len(kvs[1])-1], -1)
+ as := reA.FindAllStringSubmatch(kvs[1][1:len(kvs[1])-1], -1)
a := []string{}
for i := range as {
it := strings.TrimSpace(as[i][0])
@@ -57,6 +57,7 @@
}
}
+// Gom represents configuration from Gom.
type Gom struct {
name string
options map[string]interface{}
@@ -95,14 +96,14 @@
name := ""
options := make(map[string]interface{})
var items []string
- if re_group.MatchString(line) {
- envs = strings.Split(re_group.FindStringSubmatch(line)[1], ",")
+ if reGroup.MatchString(line) {
+ envs = strings.Split(reGroup.FindStringSubmatch(line)[1], ",")
for i := range envs {
envs[i] = strings.TrimSpace(envs[i])[1:]
}
valid = true
continue
- } else if re_end.MatchString(line) {
+ } else if reEnd.MatchString(line) {
if !valid {
skip--
if skip < 0 {
@@ -114,8 +115,8 @@
continue
} else if skip > 0 {
continue
- } else if re_gom.MatchString(line) {
- items = re_gom.FindStringSubmatch(line)[1:]
+ } else if reGom.MatchString(line) {
+ items = reGom.FindStringSubmatch(line)[1:]
name = unquote(items[0])
parseOptions(items[1], options)
} else {
@@ -126,5 +127,4 @@
}
goms = append(goms, Gom{name, options})
}
- return goms, nil
-}
\ No newline at end of file
+}
diff --git a/repo/installer.go b/repo/installer.go
index 6f4b2d0..b8ebcfe 100644
--- a/repo/installer.go
+++ b/repo/installer.go
@@ -58,6 +58,7 @@
Updated *UpdateTracker
}
+// NewInstaller returns an Installer instance ready to use. This is the constructor.
func NewInstaller() *Installer {
i := &Installer{}
i.Updated = NewUpdateTracker()