[go-nuts] Re: cannot find package "text/template"

2019-06-13 Thread ThisEndUp
une 13, 2019 at 1:05:15 AM UTC-4, ThisEndUp wrote: > > All of a sudden, when trying to build programs that used to work, as > recently as a couple of days ago, I'm getting > > main.go:6:2: cannot find package "text/template" in any of: > C:\Go\src\text\template (from $G

[go-nuts] cannot find package "text/template"

2019-06-12 Thread ThisEndUp
All of a sudden, when trying to build programs that used to work, as recently as a couple of days ago, I'm getting main.go:6:2: cannot find package "text/template" in any of: C:\Go\src\text\template (from $GOROOT) D:\\Go\src\text\template (from $GOPATH) I was trying this in a module, but

Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-06 Thread ThisEndUp
Oops, I left a few lines at the top of main.go out of the post: here's the whole thing: // main.go package main import ( "fmt" "net/http" ) func handleRoot(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "webpages/main.html") } func main() { http.HandleFunc("/",

Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-06 Thread ThisEndUp
Hi. Thanks for your explanation. It makes sense. However, the "magic" I asked about was based on your first suggestion: simply use http.Handle("/", http.FileServer(http.Dir("webpages"))) As I said, it works if the file to be shown is index.html. My question: how do I modify that in order to

[go-nuts] Accessing css and js files in HTML served by Go

2019-05-04 Thread ThisEndUp
I am thoroughly frustrated. I have a file named main.html that references a css and a js file. Here's the relevant portion. This is in a subdirectory of my GOPATH/src, named learn/webpages, and the css and js files are in subdirectories of that, i.e.,

[go-nuts] Re: Websocket vs Template

2019-05-02 Thread ThisEndUp
day, 1 May 2019 15:11:55 UTC+1, ThisEndUp wrote: >> >> I'm new to Go and am in the design phase of a project that will display >> live sensor data on a web page. The data are transferred via an MQTT >> broker. I have done such things in the past using a websocket but wonde

[go-nuts] Websocket vs Template

2019-05-01 Thread ThisEndUp
I'm new to Go and am in the design phase of a project that will display live sensor data on a web page. The data are transferred via an MQTT broker. I have done such things in the past using a websocket but wonder if a template would be a more appropriate method. Any thoughts? Thanks. -- You