Skip to main content
12 votes

Are there ways to speed up this string fuzzy matching in Golang?

Review I - package go-fuzzywuzzy After a quick read of your Go code, the Go code for package go-fuzzywuzzy, and the Go ...
peterSO's user avatar
  • 3,591
11 votes
Accepted

Go function to test whether a file exists

Instead of checking with an if statement if errStat is null and then returning false: ...
Eliahu Aaron's user avatar
10 votes
Accepted

golang rabbitmq message consumer

There's not really a one "right" way of doing things, and all of the others are wrong. However, there's a number of things that are considered good practice, and WRT to those, your code can do with a ...
Elias Van Ootegem's user avatar
9 votes

Translate nucleic acid sequence into its corresponding amino acid sequence

This covers an interesting topic. Great work! Because I am unfamiliar with this area, I utilized your unit testing to ensure changes I make did not break functionality. If they do, I apologize and ...
esote's user avatar
  • 3,800
8 votes
Accepted

Simple BubbleSort in GoLang

let me know what I can improve in this code. For a real-world code review, code should be correct, maintainable, reasonably efficient, and, most importantly, readable. Writing code is a process of ...
peterSO's user avatar
  • 3,591
7 votes
Accepted

Return Unique items in a Go slice

This is not idiomatic writing style in Go, because the value variable is misleading: if _, value := keys[entry]; !value { The ...
janos's user avatar
  • 113k
7 votes

Go function to test whether a file exists

Elegance is the wrong criterion. The key criterion is correctness, which implies readability and maintainability. As you read text, you notice misspelled words. Does that mean that you laboriously ...
peterSO's user avatar
  • 3,591
6 votes

Golang crypto library: security

The code in the question shows a CBC wrapper class. However, that wrapper class uses HMAC for authentication, without this being apparent in the name of the class. Having authenticated ciphertext is ...
Maarten Bodewes's user avatar
6 votes
Accepted

Go program to find duplicated files in a directory (recursively)

1. declare all 'var' at once instead of var dir string var workers int you can do var ( dir string workers int ) ...
felix's user avatar
  • 608
6 votes
Accepted

Game of life in Go

I really liked the way you used Termbox; you should try Tcell as well for fun. Review The function ...
STEEL's user avatar
  • 228
6 votes

Go grep command clone

The thing is, even so, standard grep still gets results faster by an amount of 60 % less processing time For more information on what makes GNU grep fast, read this by the original author. Here is ...
esote's user avatar
  • 3,800
6 votes

Golang execute several go routine in loop and then wait

Every time you execute a go statement it is passed to the scheduler. What if scheduling is delayed? wg.Add(1) is not executed ...
peterSO's user avatar
  • 3,591
6 votes

Go implementation of dining philosophers

All in all, it's not a bad implementation at all. The bulk of my comments will focus on idiomatic golang stuff, and some small tweaks you can make to the main ...
Elias Van Ootegem's user avatar
6 votes
Accepted

Matrix Transpose in Golang

In Go, measure performance. Run benchmarks using the Go testing package. For example, ...
peterSO's user avatar
  • 3,591
5 votes
Accepted

Binary search tree implementation in golang

Some quick remarks: The type BNode is public, but the insert function isn't. This is quite strange. ...
fstanis's user avatar
  • 380
5 votes

Parsing command line arguments in Go

You should definitely rely on a library to achieve this. The flag package from standard library is nice, but go-flags is even better With this library, the ...
felix's user avatar
  • 608
5 votes

Newton's algorithm for a polynomial of arbitary degree

In general, LGTM. Few notes: The name f is meaningless. newtonDelta perhaps? It feels right to compute a derivative's ...
vnp's user avatar
  • 58.7k
5 votes

Weighted Probability in Go

You are looking for the Alias method as outlined in this StackOverflow question. The basic idea is to precompute some tables that turn a random number in [0, 1) into a value in your distribution. It ...
Alex Reinking's user avatar
5 votes

Weighted Probability in Go

I see two main issues with this piece of code: the code is hard to read, and not idiomatic there is no tests/benchmarks 1. Readability It's always a good idea to run ...
felix's user avatar
  • 608
5 votes

Google Translate CLI

In several places you use fmt.Println followed by os.Exit. You may create your own Exit ...
sineemore's user avatar
  • 1,795
5 votes
Accepted

Reading lines from a file and processing them concurrently

The general approach seems fine. You may want to benchmark your application based on the type of inputs you'll receive and the type of computation that's done. If the computation is CPU intensive, it ...
svsd's user avatar
  • 166
5 votes
Accepted

Small program to get binary diff offset between two small files

To understand your program better, I cleaned up up your code. diff.go: ...
peterSO's user avatar
  • 3,591
5 votes
Accepted

Writing to a file in Golang across concurrent go routines

Go doesn't guarantee atomicity ... so I built a simple Go interface to do that Okay, but is your implementation atomic? The only atomic operations guaranteed to be atomic in Go are through the ...
esote's user avatar
  • 3,800
5 votes

Drawing a snowman in ASCII art

Cute project ;-) Do you see where copy-paste coding got the better of you? ...
janos's user avatar
  • 113k
5 votes
Accepted

Quiz game with timer

startTimer() The time package provides timers natively. So rather than using a call to ...
esote's user avatar
  • 3,800
5 votes
Accepted

Check whether a string has all unique characters (time efficiency)

This is about the most efficient strategy you can get when it comes to uniqueness checking on a string, as far as I know. It can get pretty crazy with memory inefficiency with bigger data types, but ...
TCFP's user avatar
  • 334
5 votes
Accepted

Implementing a REST API in Go using gorilla/mux and Gorm

ID as a string is weird. I expect to see an int here to benefit of the auto increment ...
mh-cbon's user avatar
  • 409
5 votes
Accepted

Writing a test to validate that the repo is formatted

a short test to validate that all committed files in the repo are formatted. Here are some notes I made while reading your code. For a real-world code review, code should be correct, maintainable, ...
peterSO's user avatar
  • 3,591
5 votes
Accepted

Compiling Go with python

Some minor notes. I love the ternary operator and f strings, but... Here are three ways to express the same thing. There is the original way, a DRY version of ...
Stephen Rauch's user avatar
5 votes
Accepted

Computing Scrabble score in Golang

I'd greatly appreciate all sorts of tips for improving not only the solution itself but also the style to be more Go-ish. For a real-world code review, code should be correct, maintainable, ...
peterSO's user avatar
  • 3,591

Only top scored, non community-wiki answers of a minimum length are eligible