Split repository into library part and cmd part #2

Closed
opened 2019-09-02 13:25:52 +02:00 by mrngm · 3 comments
Collaborator

Typically, the main package (which becomes an executable) is situated in cmd/<executable name>: cmd/rushlink/.

Typically, the `main` package (which becomes an executable) is situated in `cmd/<executable name>`: `cmd/rushlink/`.
Owner

Ack. Do I also move all the other files there, or just the entrypoint (i.e. rushlink.go)?

Ack. Do I also move all the other files there, or just the entrypoint (i.e. `rushlink.go`)?
Author
Collaborator

Thanks for splitting the repository, but I'm reopening this because it seems you've moved more than really needed.

For example, there are exported structs and methods in internal/handlers/handlers.go. It is better to keep exported stuff out of a tree that starts with internal.

Suppose I want to write a Go program that interfaces with rushlink. I'm not interested in the binary (that's why the main package is now neatly defined in cmd/rushlink/), but I do want access to, for example, StoredPaste. It's counterintuitive (non-idiomatic) to import packages that have internal in their path, when the importing package is not part of rushlink.

Thanks for splitting the repository, but I'm reopening this because it seems you've moved more than really needed. For example, there are exported structs and methods in `internal/handlers/handlers.go`. It is better to keep exported stuff out of a tree that starts with `internal`. Suppose I want to write a Go program that interfaces with `rushlink`. I'm not interested in the binary (that's why the `main` package is now neatly defined in `cmd/rushlink/`), but I do want access to, for example, `StoredPaste`. It's counterintuitive (non-idiomatic) to import packages that have `internal` in their path, when the importing package is not part of `rushlink`.
mrngm reopened this issue 2019-09-10 23:10:13 +02:00
Author
Collaborator

Another thing pkg/gobmarsh has a pkg/ too many. See https://golang.org/doc/effective_go.html#package-names for some hints on package names; brevity is one of them.

Another thing `pkg/gobmarsh` has a `pkg/` too many. See https://golang.org/doc/effective_go.html#package-names for some hints on package names; _brevity_ is one of them.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: electricdusk/rushlink#2
No description provided.