зеркало из https://github.com/golang/dep.git
Change manifest and lock file names to manifest.toml and lock.toml
This commit is contained in:
Родитель
7b22cd825d
Коммит
d2a557e009
|
@ -11,6 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/golang/dep"
|
||||||
"github.com/golang/dep/test"
|
"github.com/golang/dep/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -56,8 +57,8 @@ func TestIntegration(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check final manifest and lock
|
// Check final manifest and lock
|
||||||
testCase.CompareFile("manifest.json", testProj.ProjPath("manifest.json"))
|
testCase.CompareFile(dep.ManifestName, testProj.ProjPath(dep.ManifestName))
|
||||||
testCase.CompareFile("lock.json", testProj.ProjPath("lock.json"))
|
testCase.CompareFile(dep.LockName, testProj.ProjPath(dep.LockName))
|
||||||
|
|
||||||
// Check vendor paths
|
// Check vendor paths
|
||||||
testProj.CompareImportPaths()
|
testProj.CompareImportPaths()
|
||||||
|
|
|
@ -14,11 +14,11 @@ The directory structure is as follows:
|
||||||
testcase.json
|
testcase.json
|
||||||
initial/
|
initial/
|
||||||
file1.go
|
file1.go
|
||||||
manifest.json
|
manifest.toml
|
||||||
...
|
...
|
||||||
final/
|
final/
|
||||||
manifest.json
|
manifest.toml
|
||||||
lock.json
|
lock.toml
|
||||||
case2/
|
case2/
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (c *Ctx) SourceManager() (*gps.SourceMgr, error) {
|
||||||
// a project root. If an absolute path is given, the search begins in that
|
// a project root. If an absolute path is given, the search begins in that
|
||||||
// directory. If a relative or empty path is given, the search start is computed
|
// directory. If a relative or empty path is given, the search start is computed
|
||||||
// from the current working directory. The search stops when a file with the
|
// from the current working directory. The search stops when a file with the
|
||||||
// name ManifestName (manifest.json, by default) is located.
|
// name ManifestName (manifest.toml, by default) is located.
|
||||||
//
|
//
|
||||||
// The Project contains the parsed manifest as well as a parsed lock file, if
|
// The Project contains the parsed manifest as well as a parsed lock file, if
|
||||||
// present. The import path is calculated as the remaining path segment
|
// present. The import path is calculated as the remaining path segment
|
||||||
|
|
|
@ -21,7 +21,7 @@ fi
|
||||||
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
files=( $(git diff "$TRAVIS_BRANCH...$VALIDATE_HEAD" --diff-filter=ACMR --name-only -- 'manifest.json' 'lock.json' 'vendor/' || true) )
|
files=( $(git diff "$TRAVIS_BRANCH...$VALIDATE_HEAD" --diff-filter=ACMR --name-only -- 'manifest.toml' 'lock.toml' 'vendor/' || true) )
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
if [ ${#files[@]} -gt 0 ]; then
|
if [ ${#files[@]} -gt 0 ]; then
|
||||||
|
@ -29,7 +29,7 @@ if [ ${#files[@]} -gt 0 ]; then
|
||||||
go build
|
go build
|
||||||
./dep ensure
|
./dep ensure
|
||||||
# Let see if the working directory is clean
|
# Let see if the working directory is clean
|
||||||
diffs="$(git status --porcelain -- vendor manifest.json lock.json 2>/dev/null)"
|
diffs="$(git status --porcelain -- vendor manifest.toml lock.toml 2>/dev/null)"
|
||||||
if [ "$diffs" ]; then
|
if [ "$diffs" ]; then
|
||||||
{
|
{
|
||||||
echo 'The result of ensure differs'
|
echo 'The result of ensure differs'
|
||||||
|
|
2
lock.go
2
lock.go
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/sdboyer/gps"
|
"github.com/sdboyer/gps"
|
||||||
)
|
)
|
||||||
|
|
||||||
const LockName = "lock.json"
|
const LockName = "lock.toml"
|
||||||
|
|
||||||
type Lock struct {
|
type Lock struct {
|
||||||
Memo []byte
|
Memo []byte
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"github.com/sdboyer/gps"
|
"github.com/sdboyer/gps"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ManifestName = "manifest.json"
|
const ManifestName = "manifest.toml"
|
||||||
|
|
||||||
type Manifest struct {
|
type Manifest struct {
|
||||||
Dependencies gps.ProjectConstraints
|
Dependencies gps.ProjectConstraints
|
||||||
|
|
|
@ -584,7 +584,7 @@ func (h *Helper) Cleanup() {
|
||||||
|
|
||||||
// ReadManifest returns the manifest in the current directory.
|
// ReadManifest returns the manifest in the current directory.
|
||||||
func (h *Helper) ReadManifest() string {
|
func (h *Helper) ReadManifest() string {
|
||||||
m := filepath.Join(h.pwd(), "manifest.json")
|
m := filepath.Join(h.pwd(), "manifest.toml")
|
||||||
h.MustExist(m)
|
h.MustExist(m)
|
||||||
|
|
||||||
f, err := ioutil.ReadFile(m)
|
f, err := ioutil.ReadFile(m)
|
||||||
|
@ -594,7 +594,7 @@ func (h *Helper) ReadManifest() string {
|
||||||
|
|
||||||
// ReadLock returns the lock in the current directory.
|
// ReadLock returns the lock in the current directory.
|
||||||
func (h *Helper) ReadLock() string {
|
func (h *Helper) ReadLock() string {
|
||||||
l := filepath.Join(h.pwd(), "lock.json")
|
l := filepath.Join(h.pwd(), "lock.toml")
|
||||||
h.MustExist(l)
|
h.MustExist(l)
|
||||||
|
|
||||||
f, err := ioutil.ReadFile(l)
|
f, err := ioutil.ReadFile(l)
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (pc *TestProjectContext) CopyFile(projectPath string, testdataPath string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc *TestProjectContext) Load() {
|
func (pc *TestProjectContext) Load() {
|
||||||
// TODO(carolynvs): Can't use Ctx.LoadProject until dep doesn't require a manifest.json at the project root or it also looks for lock.json
|
// TODO(carolynvs): Can't use Ctx.LoadProject until dep doesn't require a manifest at the project root or it also looks for lock
|
||||||
var err error
|
var err error
|
||||||
var m *Manifest
|
var m *Manifest
|
||||||
mp := pc.getManifestPath()
|
mp := pc.getManifestPath()
|
||||||
|
|
|
@ -364,7 +364,7 @@ fail:
|
||||||
|
|
||||||
func (sw *SafeWriter) PrintPreparedActions() error {
|
func (sw *SafeWriter) PrintPreparedActions() error {
|
||||||
if sw.Payload.HasManifest() {
|
if sw.Payload.HasManifest() {
|
||||||
fmt.Println("Would have written the following manifest.json:")
|
fmt.Println("Would have written the following manifest.toml:")
|
||||||
m, err := sw.Payload.Manifest.MarshalTOML()
|
m, err := sw.Payload.Manifest.MarshalTOML()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "ensure DryRun cannot serialize manifest")
|
return errors.Wrap(err, "ensure DryRun cannot serialize manifest")
|
||||||
|
@ -374,14 +374,14 @@ func (sw *SafeWriter) PrintPreparedActions() error {
|
||||||
|
|
||||||
if sw.Payload.HasLock() {
|
if sw.Payload.HasLock() {
|
||||||
if sw.Payload.LockDiff == nil {
|
if sw.Payload.LockDiff == nil {
|
||||||
fmt.Println("Would have written the following lock.json:")
|
fmt.Println("Would have written the following lock.toml:")
|
||||||
l, err := sw.Payload.Lock.MarshalTOML()
|
l, err := sw.Payload.Lock.MarshalTOML()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "ensure DryRun cannot serialize lock")
|
return errors.Wrap(err, "ensure DryRun cannot serialize lock")
|
||||||
}
|
}
|
||||||
fmt.Println(string(l))
|
fmt.Println(string(l))
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Would have written the following changes to lock.json:")
|
fmt.Println("Would have written the following changes to lock.toml:")
|
||||||
diff, err := sw.Payload.LockDiff.Format()
|
diff, err := sw.Payload.LockDiff.Format()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "ensure DryRun cannot serialize the lock diff")
|
return errors.Wrap(err, "ensure DryRun cannot serialize the lock diff")
|
||||||
|
|
Загрузка…
Ссылка в новой задаче