Added license support to the glide.yaml file
diff --git a/LICENSE b/LICENSE
index 5af85b0..f342051 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
Glide
The Masterminds
-Copyright (C) 2014-2015, Matt Butcher and Matt Farina
+Copyright (C) 2014-2016, Matt Butcher and Matt Farina
Copyright (C) 2015, Google
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/cfg/config.go b/cfg/config.go
index 8e3e107..3718e93 100644
--- a/cfg/config.go
+++ b/cfg/config.go
@@ -13,7 +13,12 @@
// Config is the top-level configuration object.
type Config struct {
- Name string `yaml:"package"`
+ Name string `yaml:"package"`
+
+ // License provides either a SPDX license or a path to a file containing
+ // the license. For more information on SPDX see http://spdx.org/licenses/.
+ // When more than one license an SPDX expression can be used.
+ License string `yaml:"license,omitempty"`
Ignore []string `yaml:"ignore,omitempty"`
Imports Dependencies `yaml:"import"`
DevImports Dependencies `yaml:"devimport,omitempty"`
@@ -22,6 +27,7 @@
// A transitive representation of a dependency for importing and exploting to yaml.
type cf struct {
Name string `yaml:"package"`
+ License string `yaml:"license,omitempty"`
Ignore []string `yaml:"ignore,omitempty"`
Imports Dependencies `yaml:"import"`
DevImports Dependencies `yaml:"devimport,omitempty"`
@@ -50,6 +56,7 @@
return err
}
c.Name = newConfig.Name
+ c.License = newConfig.License
c.Ignore = newConfig.Ignore
c.Imports = newConfig.Imports
c.DevImports = newConfig.DevImports
@@ -63,8 +70,9 @@
// MarshalYAML is a hook for gopkg.in/yaml.v2 in the marshaling process
func (c *Config) MarshalYAML() (interface{}, error) {
newConfig := &cf{
- Name: c.Name,
- Ignore: c.Ignore,
+ Name: c.Name,
+ License: c.License,
+ Ignore: c.Ignore,
}
i, err := c.Imports.Clone().DeDupe()
if err != nil {
@@ -112,6 +120,7 @@
func (c *Config) Clone() *Config {
n := &Config{}
n.Name = c.Name
+ n.License = c.License
n.Ignore = c.Ignore
n.Imports = c.Imports.Clone()
n.DevImports = c.DevImports.Clone()
diff --git a/cfg/config_test.go b/cfg/config_test.go
index 03ba08e..93b7876 100644
--- a/cfg/config_test.go
+++ b/cfg/config_test.go
@@ -8,6 +8,7 @@
var yml = `
package: fake/testing
+license: MIT
import:
- package: github.com/kylelemons/go-gypsy
subpackages:
@@ -45,6 +46,10 @@
t.Errorf("Inaccurate name found %s", cfg.Name)
}
+ if cfg.License != "MIT" {
+ t.Errorf("Inaccurate license found %s", cfg.License)
+ }
+
found := false
found2 := false
for _, i := range cfg.Imports {
@@ -82,6 +87,9 @@
if cfg2.Name != "fake/testing" {
t.Error("Config cloning failed")
}
+ if cfg2.License != "MIT" {
+ t.Error("Config cloning failed to copy License")
+ }
cfg.Name = "foo"
if cfg.Name == cfg2.Name {