lib: move internal packages to lib/internal and export ParseDockerURL and annotations#135
Conversation
To allow that, move docker_functions.go code to a "docker" package and make the exported ParseDockerURL call the internal ParseDockerURL in the "docker" package.
b6a183d to
bce539b
Compare
ParsedDockerURL was part of the internal package so a user that wants to write a function using that type can't do it because they're not able to import the internal package. Define the type docker.ParsedDockerURL as common.ParsedDockerURL.
|
|
||
| // ParseDockerURL takes a Docker URL and returns a ParsedDockerURL with its | ||
| // index URL, image name, and tag. | ||
| func ParseDockerURL(arg string) (*types.ParsedDockerURL, error) { |
There was a problem hiding this comment.
This is troublesome - the returned result is a part of internal package, so the user of the ParseDockerURL function can use it directly, but cannot write a function that takes the *types.ParsedDockerURL, because the user will not be able to import the internal package…
I think that putting the ParsedDockerURL struct in the common package will end up in cyclic dependencies again, so consider adding type ParsedDockerURL types.ParsedDockerURL somewhere in the common package and do some casting in the ParseDockerURL function.
|
Something to consider before releasing 1.0 in a separate PR - replace the type Logger interface {
Debug(i ...interface{})
Info(i ...interface{})
}so the implementer could implement the |
|
Alright, I think I'll put my comment into a separate issue. LFAD. |
|
Filed #136. |
|
Thanks! |
lib: move internal packages to lib/internal and export ParseDockerURL and annotations
Good things brought by this PR:
Fixes #133