Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Vendor go-yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
carolynvs committed May 3, 2017
1 parent 0ee9602 commit a98c8f0
Show file tree
Hide file tree
Showing 28 changed files with 10,982 additions and 54 deletions.
8 changes: 7 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ required = ["github.com/Masterminds/semver"]
name = "github.com/Masterminds/vcs"
version = "^1.11.0"

[[dependencies]]
branch = "v2"
name = "github.com/go-yaml/yaml"

[[dependencies]]
branch = "master"
name = "github.com/pelletier/go-toml"
Expand Down
3 changes: 2 additions & 1 deletion gps/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
type monitoredCmd struct {
cmd *exec.Cmd
timeout time.Duration
ctx context.Context
stdout *activityBuffer
stderr *activityBuffer
}
Expand Down Expand Up @@ -72,7 +73,7 @@ func (c *monitoredCmd) run(ctx context.Context) error {
if err := c.cmd.Process.Kill(); err != nil {
return &killCmdError{err}
}
return ctx.Err()
return c.ctx.Err()
case err := <-done:
return err
}
Expand Down
21 changes: 1 addition & 20 deletions gps/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func mkTestCmd(iterations int) *monitoredCmd {
}

func TestMonitoredCmd(t *testing.T) {
// Sleeps and compile make this a bit slow
// Sleeps make this a bit slow
if testing.Short() {
t.Skip("skipping test with sleeps on short")
}
Expand Down Expand Up @@ -58,23 +58,4 @@ func TestMonitoredCmd(t *testing.T) {
if cmd2.stdout.buf.String() != expectedOutput {
t.Errorf("Unexpected output:\n\t(GOT): %s\n\t(WNT): %s", cmd2.stdout.buf.String(), expectedOutput)
}

ctx, cancel := context.WithCancel(context.Background())
sync1, errchan := make(chan struct{}), make(chan error)
cmd3 := mkTestCmd(2)
go func() {
close(sync1)
errchan <- cmd3.run(ctx)
}()

// Make sure goroutine is at least started before we cancel the context.
<-sync1
// Give it a bit to get the process started.
<-time.After(5 * time.Millisecond)
cancel()

err = <-errchan
if err != context.Canceled {
t.Errorf("should have gotten canceled error, got %s", err)
}
}
7 changes: 7 additions & 0 deletions gps/deduce.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,13 @@ func (dc *deductionCoordinator) deduceRootPath(ctx context.Context, path string)
returnFunc: func(pd pathDeduction) {
dc.mut.Lock()
dc.rootxt.Insert(pd.root, pd.mb)

if pd.root != path {
// Replace the vanity deducer with a real result set, so
// that subsequent deductions don't hit the network
// again.
dc.rootxt.Insert(path, pd.mb)
}
dc.mut.Unlock()
},
}
Expand Down
37 changes: 10 additions & 27 deletions gps/deduce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,18 @@ var pathDeductionFixtures = map[string][]pathDeductionFixture{
root: "golang.org/x/exp",
mb: maybeGitSource{url: mkurl("https://go.googlesource.com/exp")},
},
{
in: "golang.org/x/net/html",
root: "golang.org/x/net",
mb: maybeGitSource{url: mkurl("https://go.googlesource.com/net")},
},
// rsc.io appears to have broken
//{
//in: "rsc.io/pdf",
//root: "rsc.io/pdf",
//mb: maybeGitSource{url: mkurl("https://github.com/rsc/pdf")},
//},
},
}

func TestDeduceFromPath(t *testing.T) {
do := func(typ string, fixtures []pathDeductionFixture, t *testing.T) {
for typ, fixtures := range pathDeductionFixtures {
typ, fixtures := typ, fixtures
t.Run(typ, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -587,21 +589,6 @@ func TestDeduceFromPath(t *testing.T) {
}
})
}
for typ, fixtures := range pathDeductionFixtures {
typ, fixtures := typ, fixtures
t.Run("first", func(t *testing.T) {
do(typ, fixtures, t)
})
}

// Run the test set twice to ensure results are correct for both cached
// and uncached deductions.
for typ, fixtures := range pathDeductionFixtures {
typ, fixtures := typ, fixtures
t.Run("second", func(t *testing.T) {
do(typ, fixtures, t)
})
}
}

func TestVanityDeduction(t *testing.T) {
Expand All @@ -615,7 +602,7 @@ func TestVanityDeduction(t *testing.T) {
vanities := pathDeductionFixtures["vanity"]
// group to avoid sourcemanager cleanup
ctx := context.Background()
do := func(t *testing.T) {
t.Run("vanity", func(t *testing.T) {
for _, fix := range vanities {
fix := fix
t.Run(fix.in, func(t *testing.T) {
Expand All @@ -641,11 +628,7 @@ func TestVanityDeduction(t *testing.T) {
}
})
}
}

// Run twice, to ensure correctness of cache
t.Run("first", do)
t.Run("second", do)
})
}

func TestVanityDeductionSchemeMismatch(t *testing.T) {
Expand Down
10 changes: 6 additions & 4 deletions gps/satisfy.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ func (s *solver) check(a atomWithPackages, pkgonly bool) error {
s.mtr.pop()
return err
}
if err := s.checkRevisionExists(a, dep); err != nil {
s.traceInfo(err)
return err
}
// TODO(sdboyer) decide how to refactor in order to re-enable this. Checking for
// revision existence is important...but kinda obnoxious.
//if err := s.checkRevisionExists(a, dep); err != nil {
//s.traceInfo(err)
//return err
//}
if err := s.checkPackageImportsFromDepExist(a, dep); err != nil {
s.traceInfo(err)
s.mtr.pop()
Expand Down
2 changes: 1 addition & 1 deletion gps/solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func (s *solver) getImportsAndConstraintsOf(a atomWithPackages) ([]string, []com
return nil, nil, err
}

rm, em := ptree.ToReachMap(true, false, true, s.rd.ig)
rm, em := ptree.ToReachMap(false, false, true, s.rd.ig)
// Use maps to dedupe the unique internal and external packages.
exmap, inmap := make(map[string]struct{}), make(map[string]struct{})

Expand Down
9 changes: 9 additions & 0 deletions vendor/github.com/go-yaml/yaml/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/go-yaml/yaml/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions vendor/github.com/go-yaml/yaml/LICENSE.libyaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 131 additions & 0 deletions vendor/github.com/go-yaml/yaml/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a98c8f0

Please sign in to comment.