Вот код main.go
package main
import (
"generais/kontroller"
"github.com/julienschmidt/httprouter"
"log"
"net/http"
)
func main() {
router := httprouter.New()
router.GET("/", kontroller.formEcho)
router.POST("/form_handler", kontroller.formPost)
log.Fatal(http.ListenAndServe(":8080", router))
}
Вот код контролера
package kontroller
import (
"fmt"
"github.com/julienschmidt/httprouter"
"net/http"
)
func formEcho(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
fmt.Fprint(w, "<html><body><form action='http://localhost:8080/form_handler' method='POST'><input type='text' name='some_input'></form></body></html>")
}
func formPost(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
some_input := r.PostFormValue("some_input")
fmt.Fprintf(w, "hello, %s!\n", some_input)
}
При компиляции говорит что не найдено
v-smerti@vsmerti-K8N:~/localhost/api/src/generais$ go run main.go
# command-line-arguments
./main.go:13: cannot refer to unexported name kontroller.formEcho
./main.go:13: undefined: kontroller.formEcho
./main.go:14: cannot refer to unexported name kontroller.formPost
./main.go:14: undefined: kontroller.formPost
Зарание спасибо