forked from golang/dep
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhash_in.go
57 lines (45 loc) · 1.31 KB
/
hash_in.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"github.com/pkg/errors"
"github.com/sdboyer/gps"
)
func (cmd *hashinCommand) Name() string { return "hash-inputs" }
func (cmd *hashinCommand) Args() string { return "" }
func (cmd *hashinCommand) ShortHelp() string { return "" }
func (cmd *hashinCommand) LongHelp() string { return "" }
func (cmd *hashinCommand) Hidden() bool { return true }
func (cmd *hashinCommand) Register(fs *flag.FlagSet) {
}
type hashinCommand struct{}
func (_ hashinCommand) Run(args []string) error {
p, err := depContext.loadProject("")
if err != nil {
return err
}
sm, err := depContext.sourceManager()
if err != nil {
return err
}
sm.UseDefaultSignalHandling()
defer sm.Release()
params := p.makeParams()
cpr, err := depContext.splitAbsoluteProjectRoot(p.absroot)
if err != nil {
return errors.Wrap(err, "determineProjectRoot")
}
params.RootPackageTree, err = gps.ListPackages(p.absroot, cpr)
if err != nil {
return errors.Wrap(err, "gps.ListPackages")
}
s, err := gps.Prepare(params, sm)
if err != nil {
return errors.Wrap(err, "prepare solver")
}
fmt.Println(gps.HashingInputsAsString(s))
return nil
}