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

Restructure project #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

swhsiang
Copy link

@swhsiang swhsiang commented Sep 14, 2017

WHY / WHAT

Instead of passing configuration object into each function. Initializing the configuration object in config/config.go. Those function which requires configuration can import github.com/hyperpilotio/ingestor/config and the function would be able to use the configuration object.

log/log.go Outdated
}

func newLogrusLogger(cfg config.Provider) *logrus.Logger {

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove extra space

log/log.go Outdated
}

func NewLogger(cfg config.Provider) *Logger {
return newLogrusLogger(cfg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything calls newLogrusLogger? Make it simpler just inline the method

Copy link
Author

@swhsiang swhsiang Sep 14, 2017

Choose a reason for hiding this comment

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

Line 18. This function is created to generate a new logger.

Developer can simply import github.com/hyperpilotio/ingestor/log and use those function ( ex: log.Info ) directly because the init function has been executed. If they want to have a new logger for some purposes, they can call log.NewLogger to get a new logger.

https://github.com/Hyperpilotio/ingestor/pull/10/files#diff-fbf850c1cb9fc6234051c4e9517a5274R18

version.go Outdated
var GitCommit string

// The main version number that is being run at the moment.
const Version = "0.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this being used?

Copy link
Author

Choose a reason for hiding this comment

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

Makefile

VERSION := $(shell grep "const Version " version.go | sed -E 's/.*"(.+)"$$/\1/')

docker build --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$(GIT_COMMIT) -t $(IMAGE_NAME):local .

...

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, seems quite hacky for me to grep a file for a version.
I rather make it simple for now and just remove this so we don't end up having to maintain this when we never needed it. Git commit makes a lot more sense for me.

@tnachen
Copy link
Contributor

tnachen commented Sep 14, 2017

After these fixed we can merge

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