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)

2
votes
0answers
16 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 ...
1
vote
1answer
24 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 ...
0
votes
0answers
15 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 ...
3
votes
0answers
49 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
22 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
62 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
0answers
46 views

Parse long string in Go

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 ...
2
votes
0answers
23 views

Emmental interpreter written in Go

Emmental is an interesting esoteric programming language based almost entirely on rewriting its interpreter. The language provides a very basic set of standard computing operators, and an ...
7
votes
0answers
32 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 ...
0
votes
0answers
13 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, ...
4
votes
1answer
60 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 ...
2
votes
0answers
48 views

Concurrent resizable ring buffer Golang

I'm trying to find the fastest way to enqueue and dequeue items concurrently in Go. There are some restrictions: it needs to be unbounded memory allocation should be low. multiple producers (...
2
votes
1answer
42 views

Uploading large videos using go

I am using the following function to upload videos (around 1 gb). It works properly. My requirements are (these checks are being done in a different function using the mediainfo library): check if ...
1
vote
1answer
112 views

Reading and processing a big CSV file

I am trying to write a script to read a CSV file containing 1 million domain names, look up these domain names and store the results in another CSV file. I am trying the following code, but the number ...
4
votes
1answer
28 views

recursive descent parser

Here is a non-predictive recursive descent parser I wrote for the following grammar: ...
3
votes
0answers
59 views

Golang Tour Web Crawler Exercise

In the last few days I've played around with Go a little and took the language tour. The last exercise (text here) requires you to crawl a graph that simulates a set of Web pages with links, using ...
4
votes
1answer
140 views

Encrypting strings in Golang

This is a an example application for testing some encryption and decryption functions in Golang. The functions encryptString(), ...
1
vote
0answers
25 views

Idiomatic abstract inheritance with Go

I am currently discovering Golang, and I try to implement some random variable generation functions similar to R functions. To avoid code repetition, I'd like to use inheritance, which is quite ...
4
votes
2answers
83 views

Go lang Tour Webcrawler Exercise - Solution

I am new in Go and for study I have to hold a presentation about concurrency in Go. I think the Go lang Tour - Webcrawler exercise is a nice example to talk about that. Before I will do that, it would ...
5
votes
1answer
82 views

Summing chemical properties in a CSV stream

I have written my first program in go. It's rewritten from python. Program takes csv file, emulates query ...
4
votes
0answers
67 views

ICMP ping program in Go

I've just written a ping application in Go. I'm proud of the logic, but I want some help to refactor it. The program has too much code in main, and pulling ...
4
votes
2answers
81 views

Port pinger command line tool

Checking if some port is up on the network is a very common task when working with remote services. A common way to check is using telnet, but I have two practical ...
3
votes
1answer
51 views

A scalable lock-free channel

Here's my lock-free channel impl lfchan, I didn't want to copy/paste the code here since it is multiple files. I'm trying to get an idea of what can be improved or if there are any bugs in it. chan....
1
vote
1answer
64 views

Library to handle strings and numbers

I have created a pretty bad (just being honest) Golang library. I will take any and all advice, as long as it's helpful. Sorry it's so long. Also, I easily forget some things, so many functions in <...
3
votes
1answer
53 views

Golang Flood Fill

I started learning Go a few months ago and am trying to shake the rust off after a project took me out of the Go world for several weeks. I'd appreciate a code review on this flood fill algorithm I ...
3
votes
2answers
66 views

Decimal-to-fraction solver

I have created a program that turns a decimal into a fraction: ...
3
votes
2answers
87 views

Parse Numerals from a String in Golang

I recently tried my hand at writing Go code for a project I'm working on. In order to help myself get a better grasp I decided to write a simple yet somewhat practical program for parsing numeral ...
5
votes
3answers
157 views

Selection sort algorithm

I am just trying to use Go so I will be thankful for all remarks and corrections: ...
2
votes
1answer
71 views

Regular expression matching with string slice in Go

I have a slice of strings, and within each string contains multiple key=value formatted messages. I want to pull all the keys out of the strings so I can collect ...
2
votes
1answer
73 views

MongoDB CRUD operations for various types of data in Go

First of all I am a newbie in Go. I wrote a CRUD REST API that consists of handlers, a database layer and so on, and it contains a lot of code duplication. I see some patterns here, and I know how to ...
5
votes
1answer
79 views

Circuit Simulator

I'm trying to learn Golang from Java, and to do this, I wrote a basic circuit simulator with only two circuits. Is there anything I can do better to make it more idiomatic? Simulator.go ...
1
vote
0answers
62 views

XOR 256 Block Encrypting and Decrypting

I am quite new to Go but have found it to be very useful for my use case (game server). I have a routine that encrypts/decrypts the game packets which was written in C++ which can be seen here and ...
4
votes
3answers
84 views

Command called 'sprinkle'

I have a command called sprinkle. I'm not going to explain anything about it, because I want whoever that reviews the code to also tell me how much of the command ...
2
votes
2answers
97 views

Slice chunking in Go

I have a slice with ~2.1 million log message strings in it that I am parsing for regular expression matches. For any matches, I add it to a local slice and then return said slice. ...
-1
votes
1answer
35 views

Listings Manager

I am trying to learn to code using Dependency Injection and Inversion of Control in Go. Please consider the following code. I am basically creating an interface ...
6
votes
3answers
113 views

Selection sort algorithm with increasing/decreasing sort options

I am running through some traditional algorithms in Go, and I was hoping to get feedback on efficiency and optimization. Below is a basic selection sort algorithm that takes a parameter to dictate ...
1
vote
1answer
138 views

Executing periodic tasks

I am writing a code in Golang to execute a periodic function (every 2 second). According to documentation and an example I have written two programs. Can anybody tell which one is better? Also, is ...
3
votes
4answers
132 views

Golang implementation of Pascal's triangle

How can I improve my code and make it more idiomatic? ...
6
votes
1answer
68 views

Folder watching in Go

To try and track down a troublesome AS400 bug, my company wants me to keep track of the order in which files are put into a folder. I spent an hour whipping something up in Go, but I'm still pretty ...
6
votes
0answers
106 views

Web Crawler in Go

I'm a beginner in Go, just finished the Golang tour. This crawler is not the same as the one in the exercises in the tour but something I wrote myself. I am looking for suggestions for making it ...
12
votes
1answer
127 views

A* Go application

I've written a generic implementation of the A* algorithm as a first Go program, since I had implemented that both in C and in Python before and Go reminds me a bit of both. I'm looking for general ...
10
votes
1answer
104 views

Go database helper code

Today I've implemented a database helper in Go. I'm new in Go world so I just wanted someone with more experience to take a look and tell me what is good and especially, what is bad (and why, if ...
15
votes
1answer
268 views

Bruteforce MD5 Password cracker

I just started learning Go, and I wanted to created a project to learn more about concurrency in go. I heard about Go's lightweight threads, so I wanted to give them a try. This program uses ...
5
votes
1answer
37 views
3
votes
0answers
50 views

Command-line ssh address book app

I'm trying to learn a bit about Golang and decided to try out building an SSH address book command-line app. I used a YAML library to serialize and store data in a configuration file. The app has a ...
1
vote
0answers
152 views

Mobile app backend using Gin and Gorm ORM

I'm developing backend for my mobile app by using gin-gonic and gorm ORM (mysql). But I'm not sure api and db handle huge amount requests if clients increased. for example I'm using my db struct as ...
2
votes
3answers
93 views

Checking if a value is within a time range

How can I improve the style to avoid so many float64()s? ...
1
vote
0answers
82 views

Dining philosophers using channels

I have the following code to solve dinning philosophers problem using Go channels and am looking for review comments: ...
2
votes
0answers
50 views

The perfect multi-output logger

I needed to write my own lightweight GO multi-output logger for a work project and I've come up with https://github.com/asticode/go-logger. Basically the projects works like this: ...
5
votes
1answer
70 views

Comparing md5.Sum to text from file

In learning golang, I wrote a small CLI utility that will take paths as arguments and list out their md5 hash as hex strings. Included are two flags that alter functionality, ...