-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change config file to use toml like(=). Also remove viper because ya... #45
Conversation
"source_dir": "/", | ||
"gitlab_url": "gitlab.somwhere.com", | ||
"gitlab_user": "gitlab_user", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this outside the test so that we can reuse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk. I think it will only really be used by this test. If other tests need it, then we can move it out then
return ioutil.WriteFile(fileName, []byte(r), 0644) | ||
} | ||
|
||
func ReadTomlLike(fileName string) (map[string]string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this simply accessible to parser.go
? Interesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any file can see anything declared in the same package including inside other files.
func ReadTomlLike(fileName string) (map[string]string, error) { | ||
m := make(map[string]string) | ||
if _, err := os.Stat(fileName); err == nil { | ||
r, err := regexp.Compile(`^([^\s#]+)\s*=\s*([^\s]+)$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured it out!
func ReadTomlLike(fileName string) (map[string]string, error) { | ||
m := make(map[string]string) | ||
if _, err := os.Stat(fileName); err == nil { | ||
r, err := regexp.Compile(`^([^\s#]+)\s*=\s*([^\s]+)$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex to parse key=value
.
|
||
func ReadTomlLike(fileName string) (map[string]string, error) { | ||
m := make(map[string]string) | ||
if _, err := os.Stat(fileName); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this describe just the structure or also return the contents? Can't we simply use read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this just checks if it exists.
Couple of questions.. Should add some comments but looks good otherwise |
new file format:
github_user = benjamincaldwell
source_dir = /Users/benjamincaldwell
@karanthukral