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

added config path to Service interface #255

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

Conversation

jasmingacic
Copy link

For some sort of automations it is practical to get information where service files are stored.

@kardianos
Copy link
Owner

This may be alright. But, the ConfigPath would need to be a separate interface; right now it breaks windows I think.

@jasmingacic
Copy link
Author

jasmingacic commented Dec 17, 2020 via email

@kardianos
Copy link
Owner

GOOS=windows go build .

@jasmingacic
Copy link
Author

@kardianos Fixed it for windows.

I also wanted to check with you if I did it right. In most of cases I renamed configPath() string, error to ConfigPath()string and refactored accordingly. Do you think that's the best approach or maybe it should be done differently?

@kardianos
Copy link
Owner

So yes, for this change to happen:

  • Make the ConfigPath return (string error).
  • Remove it from the service interface.
  • Make an optional interface it may support (windows won't implement).
  • Require a type assertion for it to use.

@jasmingacic
Copy link
Author

jasmingacic commented Dec 17, 2020

@kardianos Do you mind if I call the optional interface ConfigInfo? (I can't think of a better name right now)

@kardianos
Copy link
Owner

No. How about Metaer :) or ConfigPather

hmmm, maybe PatholoConfiger ... I'm getting worse.

Not Config, but maybe not PatholoConfiger either.

@jasmingacic
Copy link
Author

I think ConfigInfo sound ok then we can have ConfigPath and what other information might be stored there.

@jasmingacic
Copy link
Author

@kardianos I just refactored it to use the optional interface ConfigInfo, later we can decide on the name.

@coveralls
Copy link

coveralls commented Dec 17, 2020

Coverage Status

Coverage increased (+1.1%) to 13.9% when pulling f509d03 on jasmingacic:configpath into ef35c56 on kardianos:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 12.525% when pulling 20d92e3 on jasmingacic:configpath into ef35c56 on kardianos:master.

Copy link
Owner

@kardianos kardianos left a comment

Choose a reason for hiding this comment

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

Ensure you run
go mod tidy
and go fmt
prior to commit.

service.go Outdated Show resolved Hide resolved
service.go Outdated Show resolved Hide resolved
service.go Outdated Show resolved Hide resolved
service.go Outdated Show resolved Hide resolved
service.go Outdated Show resolved Hide resolved
service.go Outdated Show resolved Hide resolved
service_aix.go Outdated Show resolved Hide resolved
linux_test/Makefile Show resolved Hide resolved
@jasmingacic
Copy link
Author

@kardianos can you help me out with the test for ConfigPath how do you want to have it implemented?

@kardianos
Copy link
Owner

Go ahead and read the diffs and correct the other OSes. Also, no need to have an exported method and un-exported method that do the same thing. Just use the exported method.

@jasmingacic
Copy link
Author

So getting config value like this is fine?

	_, err = s.(service.ConfigInfoer).ConfigPath()

Also I'm not sure what you mean by read the diffs and correct the other OSes, I already did that. Unless I'm missing something.

Copy link
Owner

@kardianos kardianos left a comment

Choose a reason for hiding this comment

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

Please read all my comments carefully this time. Please read your diffs carefully.

service_aix.go Outdated Show resolved Hide resolved
service_freebsd.go Outdated Show resolved Hide resolved
service_openrc_linux.go Outdated Show resolved Hide resolved
service_solaris.go Outdated Show resolved Hide resolved
service_systemd_linux.go Outdated Show resolved Hide resolved
service_upstart_linux.go Outdated Show resolved Hide resolved
t.Fatalf("New err: %s", err)
}

_, err = s.(service.ConfigInfoer).ConfigPath()
Copy link
Author

Choose a reason for hiding this comment

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

Is this test valid?

@jasmingacic
Copy link
Author

ping

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.

None yet

4 participants