Skip to content

Commit

Permalink
Updated for Go v1.16 beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
nomad-software committed Dec 19, 2020
1 parent 171b4dc commit a1ea6c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
42 changes: 26 additions & 16 deletions file/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
// ParseModJSON parses the mode file into a data structure.
func ParseModJSON(raw string) GoMod {
data := GoMod{
Module: module{},
Require: make([]require, 0, 10),
Exclude: make([]module, 0, 10),
Replace: make([]replace, 0, 10),
Module: Module{},
Require: make([]Require, 0, 10),
Exclude: make([]Module, 0, 10),
Replace: make([]Replace, 0, 10),
Retract: make([]Retract, 0, 10),
}

err := json.Unmarshal([]byte(raw), &data)
Expand All @@ -23,27 +24,36 @@ func ParseModJSON(raw string) GoMod {

// GoMod represents parsed module json data.
type GoMod struct {
Module module
Require []require
Exclude []module
Replace []replace
Module Module
Go string
Require []Require
Exclude []Module
Replace []Replace
Retract []Retract
}

// module represents parsed module json data.
type module struct {
// Module represents parsed module json data.
type Module struct {
Path string
Version string
}

// require represents parsed module json data.
type require struct {
// Require represents parsed module json data.
type Require struct {
Path string
Version string
Indirect bool
}

// replace represents parsed module json data.
type replace struct {
Old module
New module
// Replace represents parsed module json data.
type Replace struct {
Old Module
New Module
}

// Retract represents dependency version that are retracted.
type Retract struct {
Low string
High string
Rationale string
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/nomad-software/vend

go 1.15
go 1.16
Empty file removed go.sum
Empty file.

0 comments on commit a1ea6c7

Please sign in to comment.