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)

4
votes
1answer
41 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
56 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
29 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
38 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 ...
5
votes
2answers
47 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
46 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
36 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
18 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
70 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
25 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
87 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 ...
2
votes
0answers
51 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
26 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 ...
5
votes
0answers
39 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
15 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
64 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
63 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
124 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
72 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 ...
5
votes
1answer
191 views

Encrypting strings in Golang

This is a an example application for testing some encryption and decryption functions in Golang. The functions encryptString(), ...
2
votes
0answers
27 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
96 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 ...
6
votes
1answer
85 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
79 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 ...
5
votes
2answers
90 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
53 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
57 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
67 views

Decimal-to-fraction solver

I have created a program that turns a decimal into a fraction: ...
3
votes
2answers
100 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
158 views

Selection sort algorithm

I am just trying to use Go so I will be thankful for all remarks and corrections: ...
2
votes
1answer
89 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
85 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
80 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
63 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
107 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
119 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
172 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
3answers
138 views

Golang implementation of Pascal's triangle

How can I improve my code and make it more idiomatic? ...
6
votes
1answer
69 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
108 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
129 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 ...
11
votes
1answer
114 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
295 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
54 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 ...