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.

Filter by
Sorted by
Tagged with
5
votes
1answer
114 views

Find the longest word in a string

I have written code in the language Go. I wonder if anyone can do it in a very simple and effective way, because every language has its own way to solve this problem. My experience is in JavaScript. ...
3
votes
0answers
47 views

Simple REST Base Web Server with Unit Tests

I am building out a simple web server in Go. My goal is to expand on this framework in a different application I am building. Here is my github repo https://github.com/jmacnc/gowebserver Is what I ...
1
vote
3answers
632 views

Remove adjacent duplicates in golang

This is an exercise in a book which ask me to implement Write an in-place function to eliminate adjacent duplicates in a []string slice. I am relatively new to golang and I am not sure if my ...
1
vote
1answer
80 views

Go command-line tool to do some simple byte manipulation

I have some files containing 16-bit words in big-endian order, and a tool to process them that assumes little-endian order. I therefore need to swap the order of each pair of bytes in my files. This ...
4
votes
1answer
570 views

Go implementation of dining philosophers

Follow-up of this question. Questions: is this code a correct implementation of the Dining Philosophers problem? what is there to improve regarding Go Best Practices? ...
2
votes
1answer
156 views

Gin framework project with an endpoint to return a list of users based on their score

My relevant work experience is with Java (mostly web development with Dropwizard/Spring) so I can not avoid using the same practices as I do in a Java project. The project is there but I am going to ...
1
vote
0answers
26 views

Go - avoid result reassignement in OOP [duplicate]

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: The code implements the steps a podracer takes to ...
1
vote
1answer
60 views

Simulating pod racing over a 2D map : am I implementing OOP in a GO-like fashion?

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. I used an OOP design. Is it correctly implemented ...
3
votes
0answers
48 views

N-Queens problem using other pieces using Go

I wrote a solution to a problem based on the N-Queens problem which should use more pieces than just queens. Problem is it's very slow, it probably has to do with how I modeled data and my lack of ...
1
vote
1answer
676 views

Decode Argon2 parameters and handling decode errors

I am writing a function to decode Argon2 hashed string to extract parameters. I need to handle many decode errors, and handle those errors lead to write many repeating ...
3
votes
0answers
67 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 ...
1
vote
0answers
213 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
67 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
35 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: ...
7
votes
1answer
145 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
91 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
682 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
82 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
300 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: ...
2
votes
0answers
170 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
348 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
150 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
77 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
115 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 ...
4
votes
1answer
278 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
63 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: ...
1
vote
0answers
158 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 ...
7
votes
2answers
82 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 ...
2
votes
2answers
4k 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 ...
1
vote
1answer
443 views

Check mongodb status is running or not

I have written a program in golang which checks the mongodb is running or not using commands. But I'm not sure that the program is sufficient or there is something that needs to change in the program. ...
2
votes
1answer
99 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
32 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: ...
5
votes
0answers
381 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 ...
1
vote
1answer
49 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
42 views

Swapping alternate nodes of linkedlist

...
4
votes
1answer
142 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
115 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
897 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
382 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
35 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: ...
2
votes
0answers
1k 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
444 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 ...
4
votes
1answer
4k 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
692 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 <...
7
votes
1answer
137 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
225 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 ...
9
votes
1answer
154 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
63 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 ...
6
votes
1answer
79 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
78 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 ...

1 2 3
4
5
11