diff --git a/lock.go b/lock.go index 244dceca83..17af55193f 100644 --- a/lock.go +++ b/lock.go @@ -7,7 +7,6 @@ package dep import ( "bytes" "encoding/hex" - "encoding/json" "fmt" "io" "sort" @@ -25,17 +24,17 @@ type Lock struct { } type rawLock struct { - Memo string `json:"memo"` - P []lockedDep `json:"projects"` + Memo string + P []lockedDep } type lockedDep struct { - Name string `json:"name"` - Version string `json:"version,omitempty"` - Branch string `json:"branch,omitempty"` - Revision string `json:"revision"` - Source string `json:"source,omitempty"` - Packages []string `json:"packages"` + Name string + Version string + Branch string + Revision string + Source string + Packages []string } func readLock(r io.Reader) (*Lock, error) { @@ -115,18 +114,6 @@ func (l *Lock) toRaw() rawLock { return raw } -func (l *Lock) MarshalJSON() ([]byte, error) { - raw := l.toRaw() - - var buf bytes.Buffer - enc := json.NewEncoder(&buf) - enc.SetIndent("", " ") - enc.SetEscapeHTML(false) - err := enc.Encode(raw) - - return buf.Bytes(), err -} - func (l *Lock) MarshalTOML() (string, error) { raw := l.toRaw() diff --git a/manifest.go b/manifest.go index f3e2e39468..5bf4b7ec36 100644 --- a/manifest.go +++ b/manifest.go @@ -5,7 +5,6 @@ package dep import ( - "bytes" "encoding/json" "fmt" "io" @@ -25,17 +24,10 @@ type Manifest struct { } type rawManifest struct { - Dependencies map[string]possibleProps `json:"dependencies,omitempty"` - Overrides map[string]possibleProps `json:"overrides,omitempty"` - Ignores []string `json:"ignores,omitempty"` - Required []string `json:"required,omitempty"` -} - -type possibleProps struct { - Branch string `json:"branch,omitempty"` - Revision string `json:"revision,omitempty"` - Version string `json:"version,omitempty"` - Source string `json:"source,omitempty"` + Dependencies map[string]possibleProps + Overrides map[string]possibleProps + Ignores []string + Required []string } func newRawManifest() rawManifest { @@ -47,6 +39,13 @@ func newRawManifest() rawManifest { } } +type possibleProps struct { + Branch string + Revision string + Version string + Source string +} + func readManifest(r io.Reader) (*Manifest, error) { rm := rawManifest{} err := json.NewDecoder(r).Decode(&rm) @@ -127,18 +126,6 @@ func (m *Manifest) toRaw() rawManifest { return raw } -func (m *Manifest) MarshalJSON() ([]byte, error) { - raw := m.toRaw() - - var buf bytes.Buffer - enc := json.NewEncoder(&buf) - enc.SetIndent("", " ") - enc.SetEscapeHTML(false) - err := enc.Encode(raw) - - return buf.Bytes(), err -} - func (m *Manifest) MarshalTOML() (string, error) { raw := m.toRaw()