Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

new package: depfile #537

Merged
merged 1 commit into from
Jan 12, 2016
Merged

new package: depfile #537

merged 1 commit into from
Jan 12, 2016

Conversation

davecheney
Copy link
Contributor

This package parses an io.Reader consisting of key/value pairs into a map[string]map[string]string. The format of the line is

name key=value [key=value]...

The intention is this package will be used to parse a dependency file, or depfile, consisting of lines like this

github.com/pkg/profile version=0.1.0
github.com/docker/docker version=1.7.0

note: this package does not assign semantic meaning to the contents of the map[string]map[string]string.

@tianon
Copy link
Member

tianon commented Jan 12, 2016

This is a really simple file format! Easy to read, write, and parse, even in raw shell scripting. +1 here

@tianon
Copy link
Member

tianon commented Jan 12, 2016

Do you envision specifying version ranges or constraints in this format somehow later, or planning to keep it really simple?

@kostya-sh
Copy link

https://xkcd.com/927/ ;)

@davecheney
Copy link
Contributor Author

@tianon

Do you envision specifying version ranges or constraints in this format somehow later, or planning to keep it really simple?

This package just parses the file into map[string]map[string]string, it's up to the caller to interpret what that means.

wrt. questions about ranges and constraints, the decision in #536 is to use this file to specify a direct mapping of import path prefix to version number. Maybe if gb is extended to work with libraries, ranges could be added, but that's up to the calling code to interpret it, not this package.

@davecheney
Copy link
Contributor Author

@kostya-sh yup, that's about the size of it. I'm tired of JSON's inability to deal with numbers, and there are no other encodings save text/csv and xml in the standard library, so this will suffice.

@tianon
Copy link
Member

tianon commented Jan 12, 2016 via email

@davecheney
Copy link
Contributor Author

@tianon should be, it's just key=value, you can have multiple kv pairs. Here is an example of an valid, but entirely bogus depfile

// use docker 1.7.0
github.com/docker/docker version=1.7.0 vcs=git

// use paultag's fork
github.com/docker/machine remote=https://github.com/paultag/machine rev=ebcidic

@tianon
Copy link
Member

tianon commented Jan 12, 2016

Yeah, apologies -- I didn't want to get this straying too far from the actual file format (since how to use the file format for dependencies is definitely a separate discussion), but IMO thinking about the use case for the format is helpful when designing it. 👍

Seems sane enough to me!

@davecheney
Copy link
Contributor Author

One case which is not covered is quoting whitespace. I don't plan to add it til it is needed.

davecheney added a commit that referenced this pull request Jan 12, 2016
@davecheney davecheney merged commit 10911c7 into master Jan 12, 2016
@davecheney davecheney deleted the depfile branch January 12, 2016 23:02
@kostya-sh
Copy link

@davecheney, I am actually quite like this format. Still I beleive having a single format for all Go dependency management tools would be better.

Very minor nit: depfile is not very suitable name for a package does not assign semantic meaning to the contents of the map[string]map[string]string

@davecheney
Copy link
Contributor Author

I'll probably move this package out of gb, I think it'll be called taggedkv.

re: no single format, yes I am disappointed as well.

On 13 Jan 2016, at 11:19, kostya-sh notifications@github.com wrote:

@davecheney, I am actually quite like this format. Still I beleive having a single format for all Go dependency management tools would be better.

Very minor nit: depfile is not very suitable name for a package does not assign semantic meaning to the contents of the map[string]map[string]string


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants