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.
0
votes
0answers
12 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
0answers
36 views
2
votes
0answers
24 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
35 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
24 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
23 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
91 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
23 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 ...
3
votes
0answers
18 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
54 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
49 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
41 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
47 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
41 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
37 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
77 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
185 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
36 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
31 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
157 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
43 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
83 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 ...
0
votes
1answer
43 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
47 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
215 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
64 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
42 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
44 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
52 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
43 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
95 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
28 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
58 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
161 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 ...
3
votes
0answers
36 views
xkcd comics data provider
Please help me improving this code(golang), thanks!
Why I need built a API for xkcd
Can't get the data provided by xkcd directly in front-end(CORS).
So we can package the data to 10 comics per ...
3
votes
2answers
47 views
Optimized Int Reader
I am new in Golang, and decided to create a function that could cater to my needs of reading an integer from stdin. I need the function to be as efficient and fast ...
6
votes
2answers
63 views
Lexer for an experimental tiny language in Go
I am implementing a lexer for an experimental language by the name "Phoenix", the language supports four primary arithmetic expression for integers only (add, subtract, multiply, divide), variable ...
4
votes
1answer
61 views
Quicksort implementation in Go
Learning Go and trying to get a grip of the various concepts it uses. Following is my implementation of Quicksort (choosing last element as pivot). It takes the length of the array and the subsequent ...
3
votes
1answer
66 views
Create a new unique file
For debugging purposes I am storing requests into files. This code is supposed to create a new file for each request.
Somehow it doesn't look very nice, can it be improved? Additionally it would be ...
2
votes
1answer
55 views
Byte conversion in my Caesar's cipher
I was wondering if I am doing any useless conversions byte←→int, for example:
byte((int(ch-'A')+shift)%26 + 'A')
Converting ...
4
votes
1answer
95 views
Recursive Web Crawler in Go
This is probably my third Go application. It essentially takes one or two command line arguments of wikipedia articles and pulls every /wiki/ link that isn't a special page, memoizes them to avoid ...
1
vote
0answers
26 views
Formatting a CHANGES text file as HTML
I have a function which is used to convert text (a CHANGES file) into HTML for reading. The function is essentially line-based: if the line is of this type, do this thing; if some other type, do that ...
0
votes
0answers
399 views
Golang: reading and writing files in parallel
I am trying to read a big file line by line, inspect and cleanse each row and write to either of two output files depending on the outcome. I am using channels for this. I am still quite new to this ...
3
votes
1answer
72 views
Simple HTTP server that performs a regex test
I'm sure that my server can work with better performance, but it's just a dream.
Parsing a very long strings is not so obvious task for me.
I have a server that handles a lot of clients requests and ...
5
votes
0answers
52 views
Pomodoro timer in Go
My goal is to implement a simple pomodoro timer using Go: channels, goroutines. I'm newbie in Go world and have some misunderstanding about naming convention. I read a lot of Docker's code on GitHub ...
1
vote
1answer
24 views
Plotting savings rate in Go
I'm picking up Go, and wrote this simple script to parse a two csv files (spending.csv and savings.csv) to plot savings rate graph.
I would like to hear some generic comments on code readability, ...
5
votes
1answer
74 views
Alternate letters to UpperCase
As an exercise I repeated this Java question, but in Go: Convert string to mixed case
The objective is for every second letter to be converted to uppercase.
Go string processing is relatively new to ...