mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-11-16 01:07:26 +00:00
Merge pull request #210 from itmecho/feature/hacktober-go
Adding a basic go json example
This commit is contained in:
commit
0e23257c8a
@ -446,6 +446,10 @@ Please note that this project is released with a [Code of Conduct](CODE_OF_CONDU
|
|||||||
|
|
||||||
# I
|
# I
|
||||||
|
|
||||||
|
### Iain Earl
|
||||||
|
- DevOps Engineer, UK
|
||||||
|
- [![github-alt][github-img]](https://github.com/itmecho)
|
||||||
|
|
||||||
### IGC
|
### IGC
|
||||||
- I am a Spanish CS student and developer.
|
- I am a Spanish CS student and developer.
|
||||||
- I like Java and Python.
|
- I like Java and Python.
|
||||||
|
22
code/hacktober.go
Normal file
22
code/hacktober.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Hacktober struct {
|
||||||
|
Message string `json:"msg"`
|
||||||
|
Date time.Time `json:"date"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func main () {
|
||||||
|
data := Hacktober{
|
||||||
|
Message: "Hello Hacktoberfest 2018!",
|
||||||
|
Date: time.Now(),
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonBytes, _ := json.MarshalIndent(data, "", " ")
|
||||||
|
fmt.Println(string(jsonBytes))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user