Skip to main content

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
2 votes
1 answer
1k views

I'm working on a new project with go. So I figured I would give this new feature a run (it's fun!). Although, I'm not sure I'm implementing this the way it's suposed to be. I've read the following ...
Russo's user avatar
  • 123
2 votes
1 answer
166 views

Just started learning Go recently. Did some questions from Cracking the Coding Interview book. Wrote the solutions in Go. Let me know what you think. https://github.com/samjingwen/ctci Below is ...
Sam Jing Wen's user avatar
1 vote
1 answer
344 views

Yesterday I build some generic functions for the new official Golang 1.18 release. What do you think about it and what could be added and improved? ...
Erik Bent's user avatar
2 votes
1 answer
469 views

I am trying to read bunch of S3 parquet files in parallel from a S3 bucket. After reading all these files, I am populating my products and ...
AndyP's user avatar
  • 249
3 votes
1 answer
109 views

I have a simple program where I am deserializing my bytes byteSlice into a ClientProduct array struct. And then I iterate over ...
AndyP's user avatar
  • 249
1 vote
1 answer
125 views

I am trying to read multiple files in parallel in such a way so that each go routine that is reading a file write its data to that channel, then have a single go-routine that listens to that channel ...
AndyP's user avatar
  • 249
2 votes
1 answer
356 views

I tried to use Go to write a DelayQueue. I referred to the implementation in Java. So the general logic is to have a minimum heap, then try to fetch the top element ...
zysaaa's user avatar
  • 121
1 vote
1 answer
139 views

Below is my client code which stream all the customer URLs from a golang grpc server. It takes Request input parameter and streams customer URLs based on matching a ...
AndyP's user avatar
  • 249
7 votes
1 answer
188 views

The public code is SaveAsFile(). It takes a URL, checksum and authentication info, and downloads the artifact and its hash using HTTP. It saves the content as a ...
Alberto's user avatar
  • 173
1 vote
2 answers
142 views

I am working with lot of config files. I need to read all those individual config file in their own struct and then make one giant Config struct which holds all ...
AndyP's user avatar
  • 249
1 vote
0 answers
110 views

My intention is to create an API as generic and DRY as possible using Go. To achieve this, I have made some more or less common decisions: To use AJAX call to avoid reloading page when updating the ...
sibert's user avatar
  • 119
0 votes
1 answer
490 views

The package is essentially a small wrapper around the stdlib logger that provides a very simple, easy to use logger that can toggle between different log levels (DEBUG, INFO, WARNING, ERROR). Log ...
CageFury's user avatar
2 votes
0 answers
217 views

Exercise is here: https://go.dev/tour/concurrency/10 Prompt: In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel ...
CageFury's user avatar
1 vote
2 answers
101 views

i have logic module for head, last, page, limit and offset filter. such as : ../example/param if no query, return all value ../example/param?limit=10 return the first 10 value ..example/param?offset=...
Gilbert M.Carter's user avatar
7 votes
1 answer
3k views

I want to extract tar.gz file and store the contents in the same directory. I got below method which does the job but I wanted to see if there is any way to improve ...
AndyP's user avatar
  • 249
1 vote
1 answer
87 views

The following code bellow is a factory which creates two different objects for marshalling cyphered and ...
Maksim Shcherbo's user avatar
0 votes
1 answer
1k views

Created a MongoDB client which is handling the retry in case of server connection failure. Please review and how I can improve further. ...
Srikanth's user avatar
  • 135
2 votes
1 answer
269 views

At heart, this program is just the basic "FizzBuzz" program. However, the program was pushed further, by making it a client-server via Unix Socket: Server run, and listening on a socket. ...
farawi's user avatar
  • 23
4 votes
2 answers
499 views

If I formatted my question wrong, feel free to notify me or update, this is my first question on this subforum This is literally my first ever Go project, decided to make a Tic Tac Toe (ironically I ...
Martijn's user avatar
  • 827
2 votes
1 answer
910 views

My goal is to safely consume an API without getting 429 Too Many Requests error, activating DDoS protection or going over system limit of maximum open file ...
beardeadclown's user avatar
2 votes
0 answers
264 views

I am new to golang and I tried to implement various cache replacement algorithms (FIFO, FILO, LRU, MRU, LFU) in a generic or flexible fashion. I added some tests as well. My implementation uses the ...
Node.JS's user avatar
  • 429
1 vote
1 answer
90 views

My code snippet represents a way of handling chained errors. I need a code-review to understand whether my way is idiomatic and relevant for the 2021? My personal requirements: I want each package of ...
Serj Piskunov's user avatar
1 vote
2 answers
1k views

I have array [1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4] so I want to move all duplicates at the end of the array [1, 2, 3, 4,1, 2, 2, 3, 3, 4, 4, 4]. is there is another best way to do the same Go Time O(n)...
Manjeet Singh's user avatar
1 vote
0 answers
58 views

I'm very new with Go (started to learn it two weeks ago) and I would like to get your comments on the code below. The code is implementation of identifier used by DHT (Kademlia) The code works as ...
bw_dev's user avatar
  • 267
1 vote
1 answer
2k views

I am trying to learn Go concurrency patterns and best practices on my own. I have invented a simple task for myself. I want to process a slice of integers in a parallel manner by dividing it into sub-...
AlwaysLearningNewStuff's user avatar
2 votes
1 answer
58 views

I have this method that I feel has code repetition that can be improved but since I am new to Go, I am not quite sure how to improve it. I would appreciate if anyone can give me their opinion. ...
Fouad's user avatar
  • 123
3 votes
2 answers
526 views

I am working on writing code for find difference between two text files that should be ideally same. the format of file is ...
lightyagami1's user avatar
1 vote
1 answer
173 views

Github repo I've attempted a backend assignment in Go from geektrust Assignment Link. I'm not sure the code that I have written is idiomatic in the go way. I need some feedback on this code based on ...
Puneet Aggarwal's user avatar
4 votes
1 answer
109 views

I implemented the freq(1) program from Plan 9 in go. ...
phillbush's user avatar
  • 864
3 votes
0 answers
308 views

I am a bit concerned about style (functions, variable names, spacings, etc.). I am also not sure about whether I should return error or panic. What do you think? ...
mynouge's user avatar
  • 31
1 vote
1 answer
103 views

Recently wrote a brainfuck interpreter in Go. Here's the Github Repo Brainfuck Areas that need work The parsing for brackets [] is still buggy and is known to fail ...
Anthony Gedeon's user avatar
5 votes
1 answer
292 views

Im fairly new to Golang and I appreciate any feedback about how to make the code cleaner. The code is called by go-routine and should update status (fail/success ...
Jenny M's user avatar
  • 271
1 vote
2 answers
198 views

I'm new to Go and I completed the first challenge from Gophercises. Any feedback would be highly appreciated. There are some things that I am unsure of if they are made in an optimal way. Github repo ...
Anthony Gedeon's user avatar
4 votes
0 answers
559 views

Description This is a simple (and hopefully) RESTful API in Golang that uses Redis. I have next to no prior experience in Golang and absolutely no prior experience with Redis. The API is a simple ...
FromTheStackAndBack's user avatar
1 vote
1 answer
769 views

I have to find the sum of number after performing square operation in the given input the negative numbers need to be ignored. The input Format is, first line is number of test cases followed by N as ...
ashofphoenix's user avatar
1 vote
1 answer
217 views

I am writing a Go package that handles communication with BoltDB as a part of some larger project. I have 2 methods for interacting with DB. ...
Przemyslaw Wilk's user avatar
2 votes
1 answer
150 views

This is my custom function to join strings from an array into one string. We can provide normal separator and the last one. ...
Sokou's user avatar
  • 21
2 votes
0 answers
108 views

I'm a beginner trying to get a better understanding of golang so I decided to write an atom feeder that runs from the terminal. I am using the gofeed library to parse the atom feeds and the tview ...
barryodev's user avatar
  • 121
2 votes
1 answer
410 views

I use the following code which works and install helm chart (in the loop) in parallel, it get a kubeconfig file (to access to k8s) create a helm client and install ...
PJEM's user avatar
  • 143
4 votes
1 answer
121 views

I have a simple golang app in which I have two background tasks that produce data,each of them use it's own channel to signal it produced another unit of data. I have a single consumer that needs the ...
WildLAppers's user avatar
2 votes
2 answers
2k views

I thought of doing the following to mock/test functions in Go and wanted some advice. Let's say you have an interface for a repository: ...
Lfa's user avatar
  • 123
1 vote
2 answers
1k views

I need to split a string by a separator but don't want to split if the separator is prefixed by the escape string. For example: ...
Cookie04's user avatar
  • 135
2 votes
1 answer
881 views

Solving the merge intervals problem in golang(link: https://leetcode.com/problems/merge-intervals/). The Problem ...
DntFrgtDSemiCln's user avatar
4 votes
1 answer
270 views

I have written some Go code that produces the output I would like, but I am unsure if the code itself "smells" good. I would like to know if it contains any anti-patterns, exemplifies bad ...
Brent Pappas's user avatar
2 votes
1 answer
123 views

I use the following code which works ok! The code is installing helm charts in loop in k8s cluster, and I want to verify that I'm writing it ok. ...
PJEM's user avatar
  • 143
1 vote
1 answer
145 views

I've been playing around with Go and finally found a use case for a little web service I could build. It takes JSON data via an HTTP POST request and sends me an email via Mailgun's API (it's used for ...
Macks's user avatar
  • 143
3 votes
1 answer
110 views

I have a simple task. Array of people object comes in, up to a thousand. Need to iterate over it, and create a custom payload for external service. I have created a working solution, but I would ...
Amiga500's user avatar
  • 133
2 votes
1 answer
82 views

I've used this code to make some inputs checks. On any failed check, I need to ask again for proper input. I used labels and goto...
Krackout's user avatar
  • 123
0 votes
2 answers
149 views

I am a JavaScript programmer beginning with Go. I tried to replicate filter and map functions like JavaScript's, as an exercise....
MrByte's user avatar
  • 11
-1 votes
1 answer
211 views

I have this find function. Is it concise, efficient and readable with good logic flow? ...
mghifariyusuf's user avatar

1
2
3 4 5
12