Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [go]

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
6 views

Golang tool to check public repositories list in Github

Didn't post on the Codereview for a while but trying to learn Golang now and wrote my first utility a few days ago and will be glad to see what I did wrong here and what can be done better. This tool ...
1
vote
0answers
20 views

Extracting attribute value from multiple XML nodes in golang?

I'm attempting to parse an SVG file to get all of the colors that are present in the file. SVGs are XML based and their structure can vary a bit. For example: ...
1
vote
0answers
17 views

client handling of tcp server in go

I'm writing a service for a ORPG and I expect traffic of about 10kb of packets per second from multiple clients. I just want to know if my approach is correct? Are there areas I can improve? This is ...
1
vote
0answers
23 views

Transforming golden and input files in test table

I'm trying to find a way to create a test table from golden and input files. I have the following dir structure: ...
6
votes
1answer
58 views

Quiz game with timer

This is my first Go program. I would like to know what could be improved, what is done wrong, and anything else that I should know. The CSV contains 10 questions with the 10 answers separated by a ...
3
votes
0answers
64 views

Writing Go object code that respects Go guidelines

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be: Am I using the ...
3
votes
1answer
74 views

Golang HTTP requests

I'm beginning to learn about Golang and I would like to have some advice about the following program. ...
3
votes
2answers
75 views

Download and save bulk URL concurrently

I am new to Go and wrote program to download and save bulk URLs concurrently. It is working correctly, but I would like to make it more efficient and follow best practices. ...
6
votes
2answers
89 views

Parse dblp XML and output sums of publications grouped by year and type

The following Go program parses a gzipped XML file (available here) which contains bibliographic information on computer science publications and has the following indicative structure: ...
1
vote
0answers
63 views

Simple Go Linux daemon to send/receive gob-encoded data on a socket

I'm currently working on a linux daemon and would like some feedback. The program is a simple unix socket server that sends around gob encoded messages. I'm still getting the hang of concurrency in go ...
7
votes
1answer
159 views

Drawing a snowman in ASCII art

I am learning Go and as an exercise I did this challenge from Code Golf (without the golfing), where an ASCII art snowman is drawn from a combination of body parts, based on an 8-digit code taken as ...
0
votes
1answer
83 views

Finding the longest Collatz sequence using Go, concurrently

I am working through this problem on project euler. Basic purpose of the code: ...
2
votes
1answer
71 views

Helium written in Go [closed]

Help me with code code review. Helium is my pet project, written in Golang. Helium is a small, simple, modular constructor with some pre-built components. https://github.com/im-kulikov/helium Simple ...
2
votes
0answers
44 views

Web server using syscalls in Go

I'm new to Go and wanted to implement a web server using system calls to get a better feel for how everything works. I'm looking for feedback on idiomatic go especially error handling and using ...
3
votes
1answer
55 views

Polynomial implementation in Golang

I am writing a numerical analysis library in golang for which I need to implement a polynomial struct. Here is the source code: ...
2
votes
1answer
58 views

Locate substrings within a file

Here, I am reading in a newline delimited file that can be millions of repeating lines that looks like this: ...
0
votes
0answers
55 views

Golang message bus for a game engine

I wrote a memory bus struct in golang to allow systems to interact with each other without knowing anything about the receiver. This is for a game engine. I know it's not good to write games in ...
6
votes
0answers
53 views

Prettify phone numbers

I am a java developer and I am trying to learn Go. I tried to make a simple code that take numbers from a .txt file and make print them in a prettier format. That ...
1
vote
2answers
92 views

Golang execute several go routine in loop and then wait

I'm new in Go and excited with its easy-to-use concurrency implementation. However I'm not sure if I'm doing it right in Golang way. Consider the code where I spawn ...
0
votes
0answers
30 views

Check mongodb status is running or not

I have written a program in golang which check the mongodb is running or not using commands. But I'm not sure that the program is sufficient or there is something need to change in the program Can you ...
0
votes
0answers
19 views

Go wrapper around io.Writer that tracks the number of bytes written

The code below implements ProgressWriter, a wrapper around io.Writer that can track the number of bytes written, and a function <...
2
votes
1answer
88 views

Finding all prime numbers within a range

I am trying to find all primes less than 2,000,000 and sum them together. My code currently takes 1'36" to run. Is there a faster way to get my solution? The logic I am following in this code is make ...
3
votes
1answer
27 views

Go API server - request handlers becoming excessively long

I'm developing a API server in Go. My route handlers are becoming excessively long, especially when the response needs a lot of information. For the following response type: ...
4
votes
0answers
361 views

CLI Utility Go - First Go Program

TLDR Python developer; first project in Go; looking for feedback :) Repo Overview I just started learning Go (need to use it at work). As a fan of project-based learning, I put together a small ...
0
votes
0answers
24 views

Plugin generator in Go

This is my first go program. It is a plugin generator and works only with Linux. The repository is open. It basically creates some Go code in some temporary file defining a function taken from ...
0
votes
0answers
20 views

Go interface design for a cluster provisioner application

I'm fairly new to Go and working on an application to create VMs in a some cloud provider. I'm trying to design interfaces and I'd love some reviews. The application creates a cluster (group of VMs ...
1
vote
1answer
40 views

Generating Image & Serving via HTTP with Go

What is does I'm reading The Go Programming Language. Below is my code for the last exercise in the first chapter, which is to create a webserver, generate an image, and serve the image via the ...
1
vote
1answer
38 views
2
votes
1answer
57 views

Reading shards from a Kinesis stream

Here is part of my implementation of reading a Kinesis stream. I am not confident that this is the best way to implement synchronizing returns from goroutine. Assuming there are N shards in the ...
2
votes
1answer
61 views

GOLang Game of Life Implementation

I decided to give Go a try and implemented a Game of Life Kata exercise in GOLang. I have no prior experience in Go and the majority of my experience comes from Java, C#, and Python. My code appears ...
3
votes
2answers
103 views

Go grep command clone

I am trying to make a simple clone of the command line utility grep. I'm working on it just for fun and to practice Go. The thing is, I am trying to make it in a way that if several files are given at ...
0
votes
1answer
48 views

Cartesian Product in Go

I am still fairly new to go, and would appreciate any tips on style, best practices, etc, but am especially interested to know if this non-recursive cartesian product implementation can be made ...
1
vote
0answers
33 views

Displaying Singapore bus arrival times using a Go template

I am wondering whether my template usage in main.go could be better. For example in other code I notice: ...
1
vote
0answers
175 views

Golang gRPC context to check if cancelled or if deadline is exceeded while running function code

I am writing a gRPC Golang application and am looking for the best way to check if the deadline is exceeded or if the client cancelled the call. On the server side I created a channel called ...
4
votes
1answer
51 views

Converting Markdown to HTML using Go

I recently ported a blog of mine from Python to Go (to improve speed and performance) and while all is great so far, I'd like some help optimising the Markdown ...
3
votes
1answer
200 views

Writing to a file in Golang across concurrent go routines

I've been reading around how golang writes to a file, and this stack overflow question and this reddit question highlights the fact Go doesn't gurantee atomicity when writing to a file system. ...
14
votes
2answers
619 views

Translate nucleic acid sequence into its corresponding amino acid sequence

Goal of the program The goal of the program is to translate a nucleic acid sequence into its corresponding amino acid sequence. The nucleic sequences have to be formatted in a specific format called <...
3
votes
0answers
48 views

Game of life in Go

I wrote the Game Of Life algorithm with Go. There are a million ways that we can implement the algorithm, but I want to know is it implemented in good-way or not? I wonder how can I improve the ...
1
vote
0answers
95 views

Handling CRUD methods with gorm and go-swagger

I've an application that uses gorm and go-swagger for a simple API. One of the route's handlers bloated to 66 lines, being ...
6
votes
0answers
102 views

Flight API querier

I am learning Go and wrote a small application that queries the Skyscanner API as my first attempt at learning. I was hoping someone more expert than me in the language could look over it at broad ...
1
vote
1answer
53 views

Finding suggested flight destinations from database in Golang

This is my first Go project. Coming from a Java developer background, this code just smells very bad. But, cannot figure out better way to do this. It's a small app to find suggested flight ...
5
votes
1answer
70 views

Small program to get binary diff offset between two small files

Trivial utility program meant to go through the list of (small) files and report file offset of the first difference between them. The goal of the code is simplicity. Any recommendations are useful. ...
4
votes
1answer
51 views

Making a Zsync file archive with checksums

I'm learning go by doing it. I tried to port the Java's ZsyncMake implementation into Golang. I also employ the Go's concurrency API with goroutine and channel. I have some experience in Java, but ...
0
votes
1answer
61 views

Modeling a classroom with teacher and students using the mediator pattern in Go

I've made this implementation of a classroom with teacher and students using mediator pattern. Mediator is the teacher and colleague are studends. Main function is the following. Main function ...
1
vote
1answer
303 views

Property file into configuration in Go

My first ever attempt at Go. Writing a small app. It takes a property file and uses it to populate a Config object. After adding the first property of the Config object (dateformat) I realised that ...
1
vote
0answers
15 views

Extract script body or script src for internal and external JS scripts respectively

I have written a function func getScriptsFromUrl that accepts a URL and creates two files with script body and script src for internal and external JS scripts ...
1
vote
0answers
75 views

Hello, World BDD in Golang

I've tried to do some BDD in Golang using Godog. File Hello.feature: ...
1
vote
2answers
84 views

Extract unique words from given text and group by letter count

The task is for training go-lang. The idea is to extract unique words sorted and grouped by length. Might be useful in learning new words. The program uses command line argument assuming it's a file ...
2
votes
0answers
97 views

Getting all unique permutations from a slice of integers slices in golang,

For a project I'm working on I have a set of number sets, and I need all unique permutations of them. I want to return only one copy of each unique number set, and I'm struggling to figure out how ...
0
votes
0answers
16 views

Go SQL relationship scanner

I have written a function which takes in an sql.Rows instance and returns an array of model.Trip instances derived from the rows....