Files
moxa/_test/plugin1.go
Sebastien Binet 476a31322d Go get ellipsis (#1)
* gi: rename gi_c into _gi_c

* gi: rename test into _test

* gi: fix README syntax
2018-06-26 10:17:01 +02:00

30 lines
525 B
Go

package sample
import (
"fmt"
"net/http"
)
var version = "v1"
type Sample struct{ Name string }
var samples = []Sample{}
func NewSample(name string) int {
fmt.Println("in NewSample", version)
i := len(samples)
samples = append(samples, Sample{Name: name})
return i
}
func WrapHandler(i int, w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Welcome to my website", samples[i].Name)
}
//func main() {
// m := &Middleware{"Test"}
// http.HandleFunc("/", Handler)
// http.ListenAndServe(":8080", nil)
//}