Go, commonly referred to as "golang", is a fast, statically typed, compiled language created by Google. The language was initially developed as an alternative to C++ for server infrastructure and has native support for concurrency.

learn more… | top users | synonyms (1)

1
vote
0answers
13 views

Print log error and save it to a file

I have created a simple custom logger to print the error log and save it to a file with specific location. ...
2
votes
1answer
47 views

Beginnings of Go web server with mongoDb

I am just learning how to use go and I'm a bit confused on how my code is supposed to be organised package wise. Am I right to have the user package? I'm planning ...
4
votes
1answer
69 views

Concurrency and locking in a chat server

I've never done concurrent programming before, but I've written one using go channels and RWMutex, but I'm not sure if my approach is idiomatic. I feel like it could all use channels (Maybe). The ...
0
votes
0answers
35 views

Using interface to decouple from database connection

I have an issue regarding unit testing for getting the response that created using http.HandleFunc(). This is about my approach to solve this problem. I create ...
2
votes
1answer
27 views

Checking whether a shop record exists

I have a method to check if the Id exists in the data or not, for example: ...
2
votes
2answers
47 views

Benchmark of Perfect Numbers

I wrote a piece of code to benchmark the detection of perfect numbers up to 10000. The original code is here, in C: ...
1
vote
1answer
38 views

Slack App OAuth flow in golang

I'm working on a Slack app that uses Slash Commands. I've been looking for an excuse to learn Go, but the online tour was a little slow paced so I tried jumping in with this project. I'm looking for ...
6
votes
1answer
35 views

How many of a particular item of clothing do I need?

I am learning Go and want to do things the go-way, please have a look this code suggest how to make it better Go. This is a simulation to determine how items of a particular type of clothing you need....
3
votes
1answer
76 views

Parallel brute-force solution for Project Euler 4 (Largest palindrome product)

The pe4Concurrent.go file given below is my first attempt at writing a concurrent programme, pe4.go is a non-concurrent implementation of the same algorithm for comparison purposes. The algorithm ...
3
votes
0answers
351 views

Making AES encryption in Go just a little easier

AES encryption in Go is already pretty simple, Gencrypt is a package that acts as a wrapper around Go's standard packages used for AES encryption to make it even more simple. https://gitlab.com/...
0
votes
0answers
23 views

cryptography routine for stream data

I have code that was taken from a C++ project, I have implemented it in Go but with this line by line re-code comes a few non-optimized parts. Being an encryption routine for incoming and outgoing ...
1
vote
1answer
32 views

Retrieve Internet explorer proxy settings from the registry

I just re-wrote a library to easily retrieve the proxy settings of Internet Explorer (self answered SO question: http://stackoverflow.com/q/41764614/3207406). Git repository GoDoc (with an example) ...
5
votes
1answer
42 views

Strip a newline and add more text to a Go bytes.Buffer

I wrote a little timer middleware to append the request duration to the end of the log message returned by the excellent Gorilla Toolkit's CombinedLoggingHandler ...
0
votes
1answer
58 views

Game Data Client: Go based Game server

In my previous question I asked how could the Redis client be improved. Here I will ask how can the Game data Client can be improved. Game Data client sits on top of Redis Client and uses datatypes ...
1
vote
1answer
75 views

Redis Client: Go based Game server

Here is my Go code to interact with a Redis server ...
2
votes
0answers
33 views

Golang nanny process starting child process

The idea here is that my executable can be started normally (in which case it runs my business logic), or it can be wrapped in a nanny process (which starts a child process to run the business logic, ...
5
votes
1answer
55 views

Basic linked list stack implementation with go

Here goes my first stack implementation with go New to the go language and it's been ages since I implemented a stack Would love to discuss the data structure implementation itself and how "goish" ...
3
votes
1answer
62 views

Golang WebSocket communication between server and app

I've written a simple application that captures frames from my webcam and streams the frames via a websocket. The stream implementation I've come up with feels weird. Networking is not my strong suit....
0
votes
1answer
37 views

Codilty, binary gap get the highest gap

I have written a solution for the codility task which is Binary Gap. finding the highest gap in Binary. for example 1041 is the input number and convert it to ...
3
votes
4answers
106 views

Vowel/consonant counter in Golang

To learn Go I decided to write a vowel/consonant counter. I really need tips/ideas on how I can improve my code. ...
3
votes
1answer
29 views

Manipulating /etc/hosts file using Go

This is my first go at a Go program that's not a variation of "Hello {$name}". It's about twice as long as my previous Python implementation, and perhaps an order of magnitude messier. The goal is to ...
4
votes
0answers
42 views

Encode object to JSON and encrypt with AES (with tests)

While the task at hand is relatively straightforward, it turned out AES in Go is a bit clunky so I was wondering if this seems right. Also, any tips on Go coding in general are more than welcome. <...
2
votes
1answer
33 views

Go version of Advent of Code, day 5 - Dealing with runes

I tried to solve the Advent of Code quiz for day 5 in Go, since my brute force algorithm wasn't efficient in Ruby. I solved the first part of the quiz with the following Go code. ...
2
votes
1answer
62 views

Benchmark switch, binary search and if-else

Just for curiosity I have done some benchmark for testing the best performance between switch, binary-search, and if-else statement. here is the code : ...
3
votes
1answer
59 views

Go fish game in Go

Based on this question, I have written my own implementation of the Go Fish game, with the following features: Full trace of all actions that happen in the game More than 2 players possible Each of ...
3
votes
1answer
44 views

Random timestamp within last 3 relative years

I'm trying to generate a random time between now and 3 years ago. To my knowledge, Go doesn't have a random(min,max) feature in either ...
4
votes
0answers
153 views

Simple Golang TCP server

I've written an itty bitty tcp server, for educational purposes. The program outputs a file if you input the correct hash (or whatever you set the environment variable to). I've performed tests on ...
1
vote
2answers
42 views

Get reputation Badge from given score

I have written code that gets the reputation badge from given score like this: I use an if-else statement here: ...
4
votes
0answers
47 views

reusing Body in http.Requests (goproxy)

Goproxy is a Go package implementing an HTTP proxy. I am using it to store requests from a client (eg: a web browser) for further processing. In an ...
8
votes
3answers
2k views

Really fast Knight's Tour using concurrency and Goroutines

In less that 5 seconds on a normal PC, I found the answer in simple brute-force. Before I met Go, I didn't believe that it will be so easy to use all the power of the PC by using Go Goroutines for ...
3
votes
1answer
79 views

Diff for successive sorted slice

I wrote some code to determine the additions and deletions that happened to a sorted slice after each (sorted) update. Git repository (includes some tests) Godoc ...
14
votes
1answer
217 views

How many days to Go?

Here's my first serious attempt at writing Go code. This program counts the number of days until a certain date and displays that in the system tray. To do that, it first reads the target date from ...
3
votes
0answers
39 views

CLI app to download a .gitignore file

I have written a simple app that adds gitignore files to the current working directory - it does this by reading files hosted on GitHub and then saving them (...
3
votes
0answers
35 views

Sorting upcoming events listed in JSON

I've written my first program in GO, a command line tool that parses JSON containing events from a file or from STDIN and outputs the upcoming events in sorted order. Please critique it! ...
3
votes
2answers
163 views

Print all lines of a text file containing the same duplicated word

I'm implementing my very first Go application and I would like to receive an hint on how to make a certain check faster. I have a huge txt file in which each line ...
5
votes
1answer
48 views

Concurrent task pool

My use case is to dispatch multiple long-running tasks to execute concurrently. The expectation is that the tasks will be IO-bound (e.g. network requests), but importantly each task is different. This ...
4
votes
2answers
157 views

Watchdog in Golang

I am new to Go. I am trying to implement a simple watchdog. It calls a function once after a certain delay has elapsed; kicking it resets the delay. Kicking it after the function has already been ...
1
vote
1answer
84 views

“Images” exercise from A Tour of Go

The "Images" exercise in A Tour of Go asks for an implementation of image.Image. I wrote two solutions, one easy and one harder (just for practice in dealing with ...
3
votes
1answer
49 views

Binary trees exercise

I'm not sure about this code but it feels ugly to me. It is a solution to this. ...
4
votes
2answers
219 views

Image Cropping and Resizing

I am building a Go based image processing worker for my web application. I am trying to be idiomatic, but I am new to Go. Any feedback, is appreciated. This program uses bimg to generate 4 square ...
3
votes
2answers
70 views

Stack based non-recursive Fibonacci - Go implementation

The following function computes a the last element in a Fibonacci sequence in Go language. ...
3
votes
0answers
51 views

Custom TCP protocol concurrent chat server

So the task was to first create a custom TCP protocol (namely ebl0) with certain parameters in its header and a number of methods to use with it (e.g. Login, Create, Join etc.). I'm not listing it ...
1
vote
1answer
46 views

Project Euler #1 in Go (counting multiples of 3 or 5 up to 1000)

I've been working on Project Euler, here was my solution for Problem #1. It gave me the proper answer, but it's egregiously slow. How can I implement this more efficiently? My math skills aren't top-...
4
votes
0answers
62 views

Manage Labels in a Gitlab Project

Background This is the first (and only) Go program I've written so far. My employer just formed a small team to make a prototype written in Go ready for production, so I (and everyone else on my ...
4
votes
1answer
45 views

Un-wrap lines in a text file

I have a function which takes a string representing a text file, joins lines which were wrapped, and returns a slice with the wrapped lines. I'm interested in ...
7
votes
1answer
107 views

Sum numbers input from terminal

The following Golang code accepts a sequence of numbers (any integer and float type) in the terminal, adds them, and prints the result (sum) to the terminal. Actually in Golang you can't add ...
4
votes
0answers
29 views

Simple Web Analytics Logger

I've been learning Go for a few months and this is one of my first projects with it. It's an analytics beacon for my low-volume blog; it emits a tracking pixel and logs parameters from the browser to ...
3
votes
1answer
45 views

Event-triggering - Ready, On, Fire

I have implemented a kind of thing that does event triggering in Golang. This is open-sourced here. Review and suggestions appreciated. First thing I am trying to implement is adding event listeners ...
5
votes
1answer
64 views

Brightness Web Server

This is the first real program I've written in Go so have at it! I wrote it because I use a tiling window manager that doesn't have any brightness control functionality (at least not that I know of). ...
5
votes
1answer
210 views

Simple Go TCP server and client

I'm a Go (and programming in general) newbie and the task was to program a Go server that would accept incoming messages, take each line, reverse its order and case and send it back. Besides doing ...