From e670ccfffff965668392468a7b76b7eac5552971 Mon Sep 17 00:00:00 2001 From: James Mills Date: Tue, 20 Jun 2017 23:36:40 -0700 Subject: [PATCH] Remove a bunch of cruft (that also really exist in exampes/) --- Dockerfile | 18 --------------- cmd/gopher/main.go | 56 --------------------------------------------- cmd/gopherd/main.go | 32 -------------------------- 3 files changed, 106 deletions(-) delete mode 100644 Dockerfile delete mode 100644 cmd/gopher/main.go delete mode 100644 cmd/gopherd/main.go diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index dbff18e..0000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM golang:alpine - -EXPOSE 70/tcp - -ENTRYPOINT ["gopherd"] -CMD [] - -RUN \ - apk add --update git && \ - rm -rf /var/cache/apk/* - -RUN mkdir -p /go/src/github.com/prologic/gopherproxy -WORKDIR /go/src/github.com/prologic/go-gopher - -COPY . /go/src/github.com/prologic/go-gopher - -RUN go get -v -d -RUN go install -v github.com/prologic/go-gopher/... diff --git a/cmd/gopher/main.go b/cmd/gopher/main.go deleted file mode 100644 index 7b69242..0000000 --- a/cmd/gopher/main.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io/ioutil" - "log" - - "github.com/prologic/go-gopher" -) - -var ( - json = flag.Bool("json", false, "display gopher directory as JSON") -) - -func main() { - var uri string - - flag.Parse() - - if len(flag.Args()) == 1 { - uri = flag.Arg(0) - } else { - uri = "gopher://gopher.floodgap.com/" - } - - res, err := gopher.Get(uri) - if err != nil { - log.Fatal(err) - } - - if res.Body != nil { - contents, err := ioutil.ReadAll(res.Body) - if err != nil { - log.Fatal(err) - } - - fmt.Print(string(contents)) - } else { - var ( - bytes []byte - err error - ) - - if *json { - bytes, err = res.Dir.ToJSON() - } else { - bytes, err = res.Dir.ToText() - } - if err != nil { - log.Fatal(err) - } - - fmt.Println(string(bytes)) - } -} diff --git a/cmd/gopherd/main.go b/cmd/gopherd/main.go deleted file mode 100644 index 98d4e5c..0000000 --- a/cmd/gopherd/main.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "flag" - "log" - "os" - - "github.com/prologic/go-gopher" -) - -func cwd() string { - dir, err := os.Getwd() - if err != nil { - log.Fatal(err) - } - return dir -} - -func main() { - var ( - bind = flag.String("bind", ":70", "port to listen on") - host = flag.String("host", "localhost", "fqdn hostname") - root = flag.String("root", cwd(), "root directory to serve") - ) - - flag.Parse() - - gopher.Handle("/", gopher.FileServer(gopher.Dir(*root))) - - server := gopher.Server{Addr: *bind, Hostname: *host} - log.Fatal(server.ListenAndServe()) -}