devtools/{depotview,hackdoc}: tie both together
Change-Id: I0a1ca3b4fa0e0a074eccbe0f8748839b926db9c1
diff --git a/devtools/hackdoc/source/source_local.go b/devtools/hackdoc/source/source_local.go
index 35ad172..feecd8b 100644
--- a/devtools/hackdoc/source/source_local.go
+++ b/devtools/hackdoc/source/source_local.go
@@ -1,6 +1,7 @@
package source
import (
+ "context"
"fmt"
"io/ioutil"
"os"
@@ -29,7 +30,7 @@
return s.root + "/" + path, nil
}
-func (s *LocalSource) IsFile(path string) (bool, error) {
+func (s *LocalSource) IsFile(ctx context.Context, path string) (bool, error) {
path, err := s.resolve(path)
if err != nil {
return false, err
@@ -44,7 +45,7 @@
return !stat.IsDir(), nil
}
-func (s *LocalSource) ReadFile(path string) ([]byte, error) {
+func (s *LocalSource) ReadFile(ctx context.Context, path string) ([]byte, error) {
path, err := s.resolve(path)
if err != nil {
return nil, err
@@ -53,7 +54,7 @@
return ioutil.ReadFile(path)
}
-func (s *LocalSource) IsDirectory(path string) (bool, error) {
+func (s *LocalSource) IsDirectory(ctx context.Context, path string) (bool, error) {
path, err := s.resolve(path)
if err != nil {
return false, err
@@ -68,11 +69,9 @@
return stat.IsDir(), nil
}
-func (s *LocalSource) CacheSet(dependencies []string, key string, value interface{}) {
- // Swallow writes. The local filesystem can always change underneath us and
- // we're not tracking anything, so we cannot ever keep caches.
-}
-
-func (s *LocalSource) CacheGet(key string) interface{} {
- return nil
+func (s *LocalSource) WebLinks(fpath string) []WebLink {
+ gitURL := fmt.Sprintf(FlagGitwebURLPattern, "master", fpath)
+ return []WebLink{
+ WebLink{Kind: "gitweb", LinkLabel: "master", LinkURL: gitURL},
+ }
}