aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmd/mbf/internal/ci/ci.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/mbf/internal/ci/ci.go b/cmd/mbf/internal/ci/ci.go
index c9d585d4..b19b6ca5 100644
--- a/cmd/mbf/internal/ci/ci.go
+++ b/cmd/mbf/internal/ci/ci.go
@@ -63,7 +63,7 @@ func inotifyAddWatch(
// Follow reads from the file at pathname and writes its contents and any new
// contents to w. follow returns if a read, write or inotify error occurs, or
-// the context is canceled.
+// the context is cancelled.
func Follow(ctx context.Context, pathname string, w io.Writer) (err error) {
var in *os.File
if in, err = inotifyInit(); err != nil {
@@ -442,13 +442,19 @@ func (p Path) fetch(ctx context.Context, id *pkg.ID, output string) error {
return err
}
+const (
+ // endpointDist accepts a Path.writeSource stream and produces a
+ // distribution for the submitted source.
+ endpointDist = "/dist"
+)
+
// MakeDist creates a hakurei distribution using the CI service.
func (p Path) MakeDist(
ctx context.Context,
w io.Writer,
output, source, version string,
) error {
- id, err := p.writeSource(ctx, w, "/dist", source, version)
+ id, err := p.writeSource(ctx, w, endpointDist, source, version)
if err != nil {
return err
}
@@ -465,7 +471,7 @@ func Serve(ctx context.Context, msg message.Msg, c *pkg.Cache) error {
}
var mux http.ServeMux
- mux.HandleFunc("POST /dist", func(w http.ResponseWriter, r *http.Request) {
+ mux.HandleFunc("POST "+endpointDist, func(w http.ResponseWriter, r *http.Request) {
s, err := readSource(w, r)
if err != nil {
msg.Verbose(err)