go Questions
5
Solved
Go's math/random library is missing a function to generate 64-bit numbers. This has been an open issue for about four years. In the meantime, what does a workaround look like?
5
I am using swaggo generate API document based on godoc syntax.
Source folder and files
|-post
|--controller.go
|--response.go
For this definition:
controller.go
package post
...
// Index godoc
...
5
Solved
So I'm working on a docker compose file to deploy my Go web server. My server uses mongo, so I added a data volume container and the mongo service in docker compose.
Then I wrote a Dockerfile in or...
6
Solved
I have used the next SQL statement in both MySQL and PostgreSQL, but it fails in PostgreSQL
db.Query(`SELECT COUNT(*) as N FROM email WHERE address = ?`, email)
with this error:
pq: F:"scan.l" ...
Shovel asked 29/10, 2012 at 10:26
2
Solved
I wrote a little web crawler and had known that the Response is a zip file.
In my limited experience with golang programing, I only know how to unzip a existing file.
Can I unzip the Response.Body ...
5
Solved
I am using os.Getenv("APP_PATH") to read from the system environment variables and it works fine when running the build of the application normally. But I need to run this Go program as a service w...
Detroit asked 31/1, 2019 at 8:24
6
Solved
When I launch in VSCode dlv dap debug, I get this message:
Couldn't start dlv dap:
Error:timed out while waiting for DAP server to start
I already have launch configurations for the project:
lunc...
Award asked 12/8, 2021 at 7:26
4
Solved
I need to build a data-structure like this:
map[string]SomeType
But it must store values for about 10 minutes and then clear it from memory.
Second condition is records amount - it must be huge...
Conative asked 25/8, 2014 at 10:43
3
I am following the "Little Go Book" by Karl Seguin, in order to learn Go.
My working environment is Visual Studio Code.
Upon debugging, when I try to call a function from the debug console, i get...
Intersperse asked 3/10, 2019 at 10:58
7
Solved
In JavaScript, I can assign:
var now = Date.now();
Then use now to calculate as a number variable
time.Time type in Go doesn't seem to meet this demand. What is the Go equivalent of JavaScript's...
Innocence asked 17/3, 2016 at 3:31
4
Solved
Is it possible to LoadOrStore into a Go sync.Map without creating a new structure every time? If not, what alternatives are available?
The use case here is if I'm using the sync.Map as a cache whe...
Balbinder asked 16/8, 2018 at 20:46
4
I wish to sell Go application. I will provide serial number to my clients. Is there ways to make it a bit more complex to crack app?
I say it is complex to crack C app and it is easy to crack Java...
Undersize asked 4/1, 2014 at 21:58
6
Solved
I'm using vscode with Go extensions to edit golang source code. Each time I want to format code, I have to press Ctrl-Shift-i on linux, Shift-Alt-F on Windows, or Ctrl-Shift-p and type format. Is i...
Amazonas asked 23/2, 2016 at 7:12
4
Solved
I'd like to write a method that will populate a Go Language array with the common timezones that are accepted by the time.Format() call, for use in an HTML template (Form select to allow them to re...
4
Solved
I am trying to install Redis on the golang:1.10.1-alpine3.7 image. I tried RUN apk add --no-cache redis, but when I tried to run the redis-cli command, I get an exit status 127, which means the giv...
Pelagian asked 28/4, 2018 at 5:1
14
I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error...
Ski asked 11/10, 2017 at 16:50
4
I recently installed lubuntu 11.04 on my pc. Following this guide on installing go from source, installing golang on my pc went well. To test my installation, I ran hello.go and got this error:
fo...
Krysta asked 14/12, 2012 at 0:32
5
Solved
What is the fastest and simplest way to generate fixed length random numbers in Go?
Say to generate 8-digits long numbers, the problem with rand.Intn(100000000) is that the result might be far le...
4
Solved
I'm getting the following golintci message:
testdrive/utils.go:92:16: G110: Potential DoS vulnerability via decompression bomb (gosec)
if _, err := io.Copy(targetFile, fileReader); err != nil {
^...
Judgeship asked 30/4, 2021 at 2:9
4
Solved
Trying to interpolate an int value into a string using %v formatter as follows, yet nothing is printed,
package main
import "fmt"
func inc(i int) int {
return i + 1
}
func main() {
fmt.Sprint...
Ormandy asked 30/4, 2018 at 7:13
10
Solved
I'm using IntelliJ Idea, and the google-go-lang-idea-plugin from:
https://github.com/mtoader/google-go-lang-idea-plugin/issues/173
When I try to add my APT provided Go installation to the Go S...
Hendel asked 1/10, 2013 at 5:8
9
Solved
I know that Insert multiple data at once more efficiency:
INSERT INTO test(n1, n2, n3)
VALUES(v1, v2, v3),(v4, v5, v6),(v7, v8, v9);
How to do that in golang?
data := []map[string]string{
{"v...
Afghani asked 14/1, 2014 at 7:32
10
Solved
I have a slice with ~2.1 million log strings in it, and I would like to create a slice of slices with the strings being as evenly distributed as possible.
Here is what I have so far:
// logs is a...
5
I have multiple structs in my application using golang. Some fields in a struct have maxsize tags, some does not have.
for e.g:
type structone struct {
fieldone string `valid:MaxSize(2)`
fieldtw...
Novosibirsk asked 22/11, 2019 at 7:30
3
Solved
guys i was wondering if it is better to to range over channel or use select, if I have only one case (my channel) and signal the end with close of the given channel ?
Given the examples:
1. https...
Porosity asked 15/5, 2019 at 5:38
© 2022 - 2024 — McMap. All rights reserved.