-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand example Gopkg.toml text; always add on init #462
Conversation
f3da373
to
ad41001
Compare
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.
lgtm
# revision = "abc123" | ||
|
||
## Overrides have the same structure as [[dependencies]], but supercede all |
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.
supersede
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.
hah, no kidding 😛
## | ||
## Overrides are a sledgehammer, and should be used only as a last resort. | ||
# [[overrides]] | ||
## Required: the root import path of the project being constrained |
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.
Perhaps just note that they have the same format, rather than repeating everything?
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.
Yeah, that'll help cut down on length, 👍
## can be used to require "main" packages. | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
|
||
## "ignored" lists a set of packages (not projects) that are ignored when |
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.
s/ignored when/ignored completely when/
## Optional: an alternate location (URL or import path) for the project's source | ||
# source = "https://github.com/myfork/package.git" | ||
## Optional, but recommended: the version constraint to enforce for the project. | ||
## Only one of "branch", "version" or "revision" can be specified. | ||
# version = "1.0.0" |
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 a constraint string like ">=0.4.0, <1.0.0"
or a specific version it has to be? Might be helpful to briefly describe these in here, or add a second line to make this behavior clear
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.
It can be either (though note that when #225 goes in, 1.0.0
will be interpreted as ^1.0.0
). It can also specify an entirely non-semver tag for a literal match.
We need a more formal writeup of all of these rules. The examples here should really just be terse, and point to said writeup.
3be598e
to
1b707ca
Compare
1b707ca
to
f4079c9
Compare
Injecting the comments at the bottom is suboptimal, as it means that additional dependencies injected by later `dep ensure` calls (under the new spec) will be separated from the original `init` set. This seems slightly annoying now, but once we add a flag to allow bypassing example injection, it'll be less of a problem.
txn_writer.go
Outdated
const exampleTOML = ` | ||
## EXAMPLES & DOCS - safe to delete! | ||
# | ||
## Dependencies define constraints on how dependent projects should be |
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.
Dependencies define constraints on dependent projects. The bit about Gopkg.lock is a bit jargony and I don't think it adds anything.
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.
yeah that's fair, i was trying to make more of a distinction than we really needed
txn_writer.go
Outdated
const exampleToml = ` | ||
# Example: | ||
const exampleTOML = ` | ||
## EXAMPLES & DOCS - safe to delete! |
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.
Example (these lines may be deleted)
txn_writer.go
Outdated
# source = "https://github.com/myfork/package.git" | ||
## Optional, but recommended: the version constraint to enforce for the project. |
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.
Put the optional but recommended one above the optional one?
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.
👍
txn_writer.go
Outdated
# branch = "master" | ||
# name = "github.com/vendor/package" | ||
# Note: revision will depend on your repository type, i.e git, svc, bzr etc... | ||
## Note: revision will depend on your repository type; git and hg have SHA1s, |
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.
This note is unnecessary IMO
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.
Dropped it
txn_writer.go
Outdated
# | ||
## Dependencies define constraints on how dependent projects should be | ||
## incorporated into Gopkg.lock. They are respected by dep whether | ||
## this project is the current project, or if it's a dependency. | ||
# [[dependencies]] |
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.
Perhaps each line should precede its documentation. It might be clearer that way.
# [[dependencies]]
## The dependencies section defines constraints ...
# name = "..."
## The required name field specifies the root...
txn_writer.go
Outdated
# revision = "abc123" | ||
# version = "1.0.0" | ||
# | ||
## [[overrides]] follow the exact same structure as [[dependencies]], but supercede |
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.
# [[overrides]]
??
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.
yeah, restructuring this. I dropped the section overall because it's duplicative of [[dependencies]]
, but i'm re-adding it because the comment text should actually be different.
Reorganized and fleshed out the text a bit more. Had to put the |
txn_writer.go
Outdated
const exampleToml = ` | ||
# Example: | ||
const exampleTOML = ` | ||
## EXAMPLE (these lines may be deleted) |
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.
Can we please not shout? :-)
txn_writer.go
Outdated
## project. Use it when your project needs a package it doesn't explicitly import - | ||
## including "main" packages. | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# |
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.
single blank please
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.
Heh, I introduced these to try to visually delineate between the groups of items, but now that their ordering is actually correct, can just rely on...yknow, TOML's rules 😄
txn_writer.go
Outdated
const exampleTOML = ` | ||
## EXAMPLE (these lines may be deleted) | ||
# | ||
## "required" lists a set of packages (not projects) that must be included in |
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 I was suggesting in the previous round of comments was that the docs should be after the thing they document, which I know is different to how it works in Go code, but in this case we're looking at a config example so I think it makes some kind of sense.
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 can see how that makes sense with the [[dependencies]]
, where it looks more or less like a section header. But with I think it'd be more confusing to do that on individual values. I can't think of a commented config file I've seen that puts descriptive docs below the values they describe.
txn_writer.go
Outdated
## Dependencies define constraints on dependent projects. They are respected by | ||
## dep whether coming from the Gopkg.toml of the current project or a dependency. | ||
# | ||
## Required: the root import path of the project being constrained. |
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.
It's easier to read if this is just an actual sentence.
The required name field specifies the root import path...
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.
Fair point - I'll see if I can rework the others, then. Mostly, I care about consistency
bec2f35
to
f861939
Compare
Expand example Gopkg.toml text; always add on init
This expands the example text we add to
Gopkg.toml
to cover all valid values for the file.It also changes the behavior of
dep init
to write out the example data unconditionally to the bottom of Gopkg.toml, rather than doing so only if nothing was to populate the manifest.I'm not sure this latter part is the best idea, but being that there will be precious few situations under which we'd have an empty manifest (once init changes are done, #277), it seems worth being more aggressive about writing out these examples.
We could also add a flag to init that allows the user to suppress writing out the examples.