Questions tagged [Go] (1062)

1
answer

How to save data obtained from a custom form in the database?

A problem that all handler s are in a separate package and I would like to know how the functions of the AddUser/GetUserInfo you can add/get data from database or how to ensure the access of these functions to a variable DB to move all the handlers in the package main. import ( "handlers" ) func main(){ //... //establish c...
Barton asked April 19th 20 at 12:48
2
answers

How to properly hash a large file?

Wanted to know about how to properly hash the file size exceeds the amount of RAM in the computer?
Kristopher asked April 19th 20 at 12:34
1
answer

How to cache images in imgproxy?

Decided to use to crop images imgproxy - and not understand: it at each request creates a thumbnail again? From the point of view of common sense, there must be some kind of cache of thumbnails (with treatment), because under load the server will lay down if a lot of pictures will be and they will be cut on each request. Or...
marco_Becker asked April 19th 20 at 12:13
1
answer

How to send post request message from the group Vkontakte?

In Python previously, when sending a message on behalf of the Vkontakte group was doing a Get request and have listed the methods in the method message just gave the line. In Go it is not roll, because there's get request does not understand the gaps, it is necessary for each gap to put the " + " to send more than one word ...
Alysson_Legr asked April 19th 20 at 12:09
1
answer

How to highlight the message at the end of the program?

Let's say eating such a simple code. func main() { fmt.Println("start") defer func() { fmt.Println("stop") }() Run() fmt.Scanln() } Zapuskaetsa he contenere. If happen error in Run both messages are highlighted and the start and stop, and if I stanovova container, the messages will not stop. How to make so that stan...
Bettie_Bode asked April 19th 20 at 12:06
1
answer

As in the slice in the html template to verify that the element is equal to something in GOLANG?

Let's say I give in HTML template slice of strings S, how can I display only non blank lines? For example, {{range .S}} {{if ????}} Display {{ .}} {{end}} {{end}}
benton_Hilpert asked April 19th 20 at 12:01
3
answers

Golang Parse time, strange behavior, but why?

Kind time, Respected community. Can who faced a similar problem more like a BUG. Tried to unmarshall a date string and not out, this is what came: func (c *CustomDate) UnmarshalJSON(b []byte) (err error) { s := strings.Trim(string(b), `"`) if s == "null" { return } t, err := time.Parse(time.RFC3339, time.RFC3339) if er...
Domenica_Grady asked April 19th 20 at 12:01
1
answer

How to get the link text from for.Request GOLANG Gorilla?

Want , the transition of the two different links handled by the same handler, but different. Displayed link text, for example: Clicked on the link "LINK1" - the screen text says "LINK1" Passed by reference "ссылка2" - the screen text says "ссылка2" Therefore, the question of whether of for.Request to get the link text? Or, ...
kristofer_Turcot asked April 19th 20 at 11:59
2
answers

How to avoid a large number of arguments in functions?

In General wrote the program, and then needed to add some additional features, which in the function instead of 2-3 arguments now 5. A good option to shove them all in some kind of structure or the correct solution would be to alter the function so that it was not necessary in this argument?
Jaeden_Polli asked April 18th 20 at 13:37
1
answer

Why do I get when testing in Golang FAIL?

Hello. Check subject test in Golang. Wrote a simple test (compare two numbers 3 answers), test passes, test coverage is 100%, but why in the end, the system writes FAIL? It seems that according to documentation there should be PASS. The program simple.go package main func Question(a int, b int) int{ if a > b { retur...
Shayna asked April 18th 20 at 13:36