Questions tagged as 'golang'

1
answer

Free up server memory space when idle

I have a code more or less with this structure: package main import ( "html/template" "net/http" "log" ) func main() { http.HandleFunc("/",taltal) http.ListenAndServe(":8080",nil) } func check(err error){ if err != n...
asked by 26.03.2017 / 05:00
1
answer

Open text file and handle by line

I'm starting the first step in go and I'm needing it first get a text file to open it and filter by line where each line is separated by | and I will make a if to show certain line Example: Text file content: |C100|1|0||5...
asked by 14.02.2017 / 03:56
1
answer

The period between two dates

How do I get a period between two dates? d1, _ := time.Parse(time.RFC3339, "2018-10-27T00:00:00Z") d2, _ := time.Parse(time.RFC3339, "2018-10-28T00:00:00Z") // Não funciona. fmt.Println(d2 - d1)     
asked by 28.10.2018 / 13:32
0
answers

connection firebird database with golang

Does anyone use Go accessing firebird database? I'm having connection problems and I can not solve it !! My connection string Conn, err: = sql.Open ("firebirdsql", "sysdba: masterkey @ localhost: \ adhnet \ adhmaster.gdb") Below is the...
asked by 10.09.2018 / 05:09
0
answers

Problems compiling for static in GO with CGO_ENABLED = 1

I created the following script to compile a project as static in go, but I'm not getting a static executable. PASTA=bin/scak_linuxAMD64 ARQUIVO=$PASTA/server_rest export GOOS=linux export GOARCH=amd64 export CGO_ENABLED=1 export CXX_FOR_TARGE...
asked by 02.09.2018 / 19:30
0
answers

error installing package oracle connection - golang

I have already installed the MinGW x64 and also TDM-GCC-64, created the environment variables pointing to the bin folder and when I give a go get github.com/mattn/go-oci8 My terminal returns this error message.     
asked by 20.07.2018 / 19:29
1
answer

Importing local libraries in GO

I'm having trouble importing a go library. The library is in a folder in the same project directory and always the import error, when not the import error, of the error to access the function. main.gopackagemainimport("fmt" "./test" ) f...
asked by 10.05.2018 / 21:15
1
answer

using twitter api with golang

I'm trying to make this request "oauth / request_token" on twitter using go. // GET PARAMS TO REQUEST t := time.Now().Format("20060102150405") values := make(url.Values) values.Add("oauth_nonce", auth.ANonce) values.Add("oauth_callback", auth....
asked by 08.05.2018 / 14:39
0
answers

Convert a variable to a reflect.Type

I started learning Go recently. I want to be able to save a data type to a variable, and convert another variable to it. I know one way to save a data type is by using reflect.Type . i := 5 t := reflect.TypeOf(i) var f float32 = 4.2 B...
asked by 29.09.2017 / 02:40
1
answer

Download package using "go get"

Installing go into /usr/local/go occurs perfectly and I can check this using: go --version When attempting to use get with: go get github.com/russross/blackfriday I get the following error:    pa...
asked by 19.09.2017 / 18:24