-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
815c8a3
commit 8f69809
Showing
9 changed files
with
204 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
package cli | ||
|
||
type LockFile map[string]LockedMod | ||
type LockfileVersion int | ||
|
||
const ( | ||
InitialLockfileVersion = LockfileVersion(iota) | ||
|
||
ModTargetsLockfileVersion | ||
|
||
// Always last | ||
nextLockfileVersion | ||
CurrentLockfileVersion = nextLockfileVersion - 1 | ||
) | ||
|
||
type LockFile struct { | ||
Mods map[string]LockedMod `json:"mods"` | ||
Version LockfileVersion `json:"version"` | ||
} | ||
|
||
type LockedMod struct { | ||
Dependencies map[string]string `json:"dependencies"` | ||
Version string `json:"version"` | ||
Hash string `json:"hash"` | ||
Link string `json:"link"` | ||
Dependencies map[string]string `json:"dependencies"` | ||
Targets map[string]LockedModTarget `json:"targets"` | ||
Version string `json:"version"` | ||
} | ||
|
||
type LockedModTarget struct { | ||
Hash string `json:"hash"` | ||
Link string `json:"link"` | ||
} | ||
|
||
func MakeLockfile() LockFile { | ||
return LockFile{ | ||
Mods: make(map[string]LockedMod), | ||
Version: CurrentLockfileVersion, | ||
} | ||
} | ||
|
||
func (l LockFile) Clone() LockFile { | ||
lockFile := make(LockFile) | ||
for k, v := range l { | ||
lockFile[k] = v | ||
lockFile := LockFile{ | ||
Mods: make(map[string]LockedMod), | ||
Version: l.Version, | ||
} | ||
for k, v := range l.Mods { | ||
lockFile.Mods[k] = v | ||
} | ||
return lockFile | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.