func (с Celsius) String() string {
return fmt.Sprintf("%g°C", c)
}
type TestStruct struct {
Id int
Data map[int]interface{}
}
func main() {
testing := map[int]TestStruct{}
testing[0] = TestStruct{
Id: 0,
}
objCopy := testing[0]
objCopy.Data = map[int]interface{}{
1: "dd",
}
testing[0] = objCopy
}
go run Setup.go
package main
import (
"fmt"
"net/http"
)
func main() {
err := http.ListenAndServe(":8090", nil)
fmt.Println("Error creating http server: ", err)
}
$ go run main.go
Error creating http server: listen tcp :8090: bind: address already in use
session, _ := mgo.Dial("mongodb://127.0.0.1")
var t = map[int]string
t := map[int]string{}
var t []string
for k, value := range config.Settings.Logs {
elem, err := tail.TailFile(value, tail.Config{Follow: true, ReOpen: true, MustExist: true})
...... тут надо ошибку проверить .....
t = append(t, elem)
}
b := a[:0]
for _, x := range a {
if x != "html_2222" && x != "css_2134234" {
b = append(b, x)
}
}
exec.Command("pgdump", "-h", opts.PostgresHost, "-p", opts.PostgresPort, "-U", opts.PostgresUsername, "-d", dbname, "-w", "Fc", "-f ", Path)
package main
import (
"encoding/xml"
"fmt"
)
type Property struct {
Name string `xml:"name,attr"`
Value string `xml:",chardata"`
}
type Object struct {
Properties []Property `xml:"PROPERTY"`
Basetype string `xml:"basetype,attr"`
Name string `xml:"name,attr"`
Oid int `xml:"oid,attr"`
}
type Response struct {
XMLName xml.Name `xml:"RESPONSE"`
Objects []Object `xml:"OBJECT"`
}
func main() {
data := []byte(`<RESPONSE>
<OBJECT basetype="status" name="status" oid="1">
<PROPERTY name="response-type">success</PROPERTY>
<PROPERTY name="response-type-numeric">0</PROPERTY>
<PROPERTY name="response">0f738648db95bb1f6ca37f6b8b5aafa8</PROPERTY>
<PROPERTY name="return-code">1</PROPERTY>
</OBJECT>
</RESPONSE>`)
var res Response
err := xml.Unmarshal(data, &res)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", res)
}
for range zipChan {
}
type Post struct {
..........................
Images []ImagePost
}
go build firstapp