My question is similar to this one and I have followed the suggestions from the last comment in this question Deploying a simple GoLang Application to AWS Elastic Beanstalk - #3 by awais . I am however still getting an error with the following, I know that there is something I must be doing wrong in this process
application.go:7:2: cannot find package “GitHub - gorilla/mux: Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍” in any of:
My code structure is this ![27 AM|690x135]
My build.sh
#!/bin/bash
go get GitHub - gorilla/mux: Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
go build -o bin/application application.go
My buildfile.text
make: ./build.sh
My Procfile.text
web: bin/application
I am new to this but the only thing I can think of it that maybe the buildfile and/or Procfile might need a different extension .
I then use zip …/eb.zip -r * .[^.]* to zip my project and upload it to AWS but it always fails once it gets done uploading . With the message that it can not find package GitHub - gorilla/mux: Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍 . Is there something I’m missing with this process … my code compiles locally and this is how it looks
package main
import (
"net/http"
"./Controllers"
"runtime"
"github.com/gorilla/mux"
"time"
)
func main() {
println(runtime.Version())
runtime.GOMAXPROCS(runtime.NumCPU())
r := mux.NewRouter()
r.HandleFunc("/testping", Controllers.TestPing)
http.Handle("/", r)
r.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("public"))))
srv := &http.Server{
ReadTimeout: 20 * time.Second,
WriteTimeout: 20 * time.Second,
IdleTimeout: 120 * time.Second,
Addr: ":5000",
}
srv.ListenAndServe()
}