PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
586 B

  1. package Package
  2. import (
  3. yaml "gopkg.in/yaml.v2"
  4. )
  5. type Manifest struct {
  6. Name string `yaml:"name"`
  7. Version string `yaml:"version"`
  8. Dependancies map[string]string `yaml:"dependancies,flow"`
  9. }
  10. func ParseManifestFile(manifest string) (Manifest, error) {
  11. var (
  12. m Manifest = Manifest{}
  13. e error
  14. )
  15. e = yaml.Unmarshal([]byte(manifest), &m)
  16. return m, e
  17. }
  18. func (m Manifest) CreateManifestString() (string, error) {
  19. var (
  20. mByte []byte
  21. e error
  22. )
  23. mByte, e = yaml.Marshal(&m)
  24. if e != nil {
  25. return "", e
  26. }
  27. return string(mByte), e
  28. }