Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues raised by go vet #17

Merged
merged 2 commits into from
Dec 7, 2014
Merged

Conversation

mordyovits
Copy link

Fixed a conflation of types between a filename and the *config.Config (source
and target). The fmt was using a %s and meant the filename but used the nil
*config.Config

Removed an erroneous strconv.Itoa. The fmt was using %d anyway.

Fixed a conflation of types between a filename and the *config.Config (source
and target).  The fmt was using a %s and meant the filename but used the nil
*config.Config

Removed an erroneous strconv.Itoa.  The fmt was using %d anyway.
@@ -51,11 +51,7 @@ func (c *Config) computeVar(beforeValue *string, regx *regexp.Regexp, headsz, ta
retVal := ""
return &retVal,
errors.New(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it to that when I get a chance.

@robfig
Copy link
Owner

robfig commented Dec 7, 2014

I don't get it -- what does renaming to *_fn fix? (Also, Go uses lowerCamel, not snake_case)

@mordyovits
Copy link
Author

The problem is in line 367:
target, error := ReadDefault(target) <-- notice how target changed types
if error != nil {
t.Fatalf("Unable to read target config file '%s'", target) <-- but is then used as if it's a string (filename)

So my patch makes clear what's a *Config and what's a string. Without my patch, whenever line 367 calls Fatalf(), what it prints is nil, not the intended filename.

The same problem was with source.

@mordyovits
Copy link
Author

Ok, fixed all the issues you raised, and it passes go test and go vet is still clean.

robfig added a commit that referenced this pull request Dec 7, 2014
@robfig robfig merged commit 0f78529 into robfig:master Dec 7, 2014
@robfig
Copy link
Owner

robfig commented Dec 7, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants