Questions tagged as 'golang'

2
answers

How is Garbage Collection implemented in Go?

In Golang I saw that this language is compiled (and that's right, the website itself tells which architectures compilers generate code for), and, to my surprise, it's Garbage Collected! Garbage Collection is virtually universal in the world...
asked by 19.04.2014 / 01:42
1
answer

What are the main characteristics of the Go language?

I started to hear a lot about GoLang and it is increasingly gaining ground among the most used programming languages. As far as I know, I think it's a programming language. So, What are the key features? Can I program and run on any o...
asked by 08.08.2017 / 17:04
2
answers

What is the difference between static and dynamic linking?

Recently, researching why small codes in Go have a much larger executable than the same C-generated code, I've read one response stating that the reason is for Go to use linking static , unlike C, which uses linking dynamic . What exact...
asked by 26.08.2016 / 22:25
1
answer

Connecting Go with MongoDB using Docker

I'm creating a microservice in Go, using MongoDB as the database and using the mgo library. Using MongoDB in a docker container locally and running the application on my machine, everything works normally, but when I tried to run using...
asked by 13.12.2017 / 21:42
2
answers

In what order is the init () method invoked in the GO Language?

I have read some posts on the Internet about the implicit call of the init() method, but I did not understand in what order it is invoked in a program written in GO Language, mainly because there could be several init methods in th...
asked by 12.09.2015 / 18:44
1
answer

Slag capacity in Golang

A slice can vary with need, and you can add items to it, right? You can view the size and its capacity ( len and cap , respectively). On the tour by Go, there is a "lesson" from append , it first creates a slice null and...
asked by 12.12.2017 / 20:49
2
answers

Web server on Go apparently is not creating new requests

I'm now starting to develop in Go, and I'm currently studying Go for Web development, so through examples I've started a simple server in Go: package main import ( "fmt" "log" "net/http" "time" "github.com/gorilla/mux" ) var Nome...
asked by 14.06.2017 / 20:13
1
answer

Why creating a slice with variable length is slower?

Using make([]byte, tamanho) it behaves differently when tamanho is a variable or a constant. Consider the two codes: package Testes import ( "testing" ) func BenchmarkConstante(b *testing.B) { const tamanho = 1024...
asked by 07.06.2018 / 00:19
2
answers

Count golang number size

I have a variable int , I need to know how many houses it has and capture the number for each house, for example my number is 57890 , I need to return the house quantity of that number, 57890 = 5 . I also need the number that i...
asked by 27.05.2017 / 13:27
1
answer

Golang - Doubt over pointers

I have a struct called Calculator, with two properties: version and author. In order to instantiate this struct already initializing these methods, since Golang does not have constructors, the various tips that I found in the net indicate to cre...
asked by 04.11.2017 / 01:02