Skip to content

Instantly share code, notes, and snippets.

View go_rate_01.go
package main
import (
"context"
"log"
"os"
"time"
"golang.org/x/time/rate"
)
@suganoo
suganoo / intf1.go
Created Feb 8, 2019
Golang polymorphisim
View intf1.go
package main
import "fmt"
type MainInterface interface {
call()
}
type HogeFunc func()
@suganoo
suganoo / embeded.go
Created Feb 1, 2019
interfaceの確認
View embeded.go
package main
import (
"fmt"
)
type BaseDownloader struct {
}
type BaseUploader struct {
@suganoo
suganoo / 01 golangdb.go
Last active Jan 25, 2019
Go言語でDB操作
View 01 golangdb.go
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
)
var Db *sql.DB
@suganoo
suganoo / interval.go
Last active Jan 21, 2019
定期実行の理解
View interval.go
package main
import (
"fmt"
"os"
"os/signal"
"time"
)
func doSomething() {
@suganoo
suganoo / 01 time_pkg.go
Last active Dec 21, 2018
Tips of Tim pkg
View 01 time_pkg.go
package main
import (
"fmt"
"time"
"strconv"
)
func main() {
fmt.Println("----- Basic usage -----")
@suganoo
suganoo / pack_gz_files.go
Created Dec 13, 2018
concatenate gz files
View pack_gz_files.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
)
func main() {
View 01 http_request.go
package main
import (
"fmt"
"net/http"
)
func body(w http.ResponseWriter, r *http.Request){
len := r.ContentLength
body := make([]byte, len)
@suganoo
suganoo / 01 go_do_command.go
Last active Nov 6, 2018
Go で外部コマンド実行
View 01 go_do_command.go
package main
import (
"fmt"
"os/exec"
"time"
"strings"
)
func main() {
@suganoo
suganoo / 01 json_sample.json
Created Oct 17, 2018
Golangでjsonを扱う
View 01 json_sample.json
{
"id" : 1,
"author" : "hogefuga",
"content" : "Hellooooooooo!!",
"comment" : {
"comment_id" : 11,
"message" : "very gooood"
},
"books" : [
{
You can’t perform that action at this time.