hands-on-6

command
v1.0.3-0...-4db7b2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package main

import (

"html/template"
"log"
"os"

)

type DataCsv struct {
	Date string
	Open float64
}

type dataCsvOverall []DataCsv

var tpl *template.Template

func init(){
	tpl = template.Must(template.ParseGlob("tpl.gohtml"))
}
func main()  {
	data := dataCsvOverall{
	DataCsv{	Date: "2015-07-09",
				Open: 523.119995,
			},
	DataCsv{	Date: "2015-07-08	",
				Open: 521.049988,
			},
	DataCsv{	Date: "2015-07-07	",
				Open: 523.130005,
			},
	}

	err := tpl.Execute(os.Stdout, data)
	if err != nil {
		log.Fatalf("%s sdjhfgjhsfgjhds",err)
	}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL