Skip to content

Commit dc61d23

Browse files
zbintliffsdboyer
authored andcommitted
Merge branch 'sourcemgr' (golang#7)
2 parents e9418a0 + 97b6780 commit dc61d23

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

analyzer.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"github.com/Masterminds/semver"
9+
"github.com/sdboyer/gps"
10+
)
11+
12+
type analyzer struct{}
13+
14+
func (a analyzer) DeriveManifestAndLock(path string, n gps.ProjectRoot) (gps.Manifest, gps.Lock, error) {
15+
// TODO initial impl would just be looking for our own manifest and lock
16+
return nil, nil, nil
17+
}
18+
19+
func (a analyzer) Info() (name string, version *semver.Version) {
20+
v, _ := semver.NewVersion("v0.0.1")
21+
return "example-analyzer", v
22+
}

sm.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2016 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package main
6+
7+
import (
8+
"fmt"
9+
"os"
10+
"path/filepath"
11+
12+
"github.com/sdboyer/gps"
13+
)
14+
15+
func getSourceManager() (*gps.SourceMgr, error) {
16+
gopath := os.Getenv("GOPATH")
17+
if gopath == "" {
18+
return nil, fmt.Errorf("GOPATH is not set")
19+
}
20+
// Use the first entry in GOPATH for the depcache
21+
first := filepath.SplitList(gopath)[0]
22+
23+
return gps.NewSourceManager(analyzer{}, filepath.Join(first, "depcache"))
24+
}

0 commit comments

Comments
 (0)