Only return the meta for requested package
the go tool currenty has a pathology where it mistakingly claims it can't clone a repo because it checks prefix by bytes, not by splitting the path on slash. Once https://github.com/golang/go/issues/15947 comes out (go1.8) then go tools will be able to handle being provided with valid but overlapping packages. For now though we'll just return meta for the requested package. Change-Id: Ie5026e7d5c1377ff7d2c2140b21f9b745af69764
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package vain
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -100,6 +101,12 @@ func (db *DB) PackageExists(path string) bool {
|
||||
func (db *DB) Package(path string) (Package, error) {
|
||||
r := Package{}
|
||||
err := db.conn.Get(&r, "SELECT * FROM packages WHERE path = ?", path)
|
||||
if err == sql.ErrNoRows {
|
||||
return r, verrors.HTTP{
|
||||
Message: fmt.Sprintf("couldn't find package %q", path),
|
||||
Code: http.StatusNotFound,
|
||||
}
|
||||
}
|
||||
return r, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user