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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
)
...
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 ...
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 ...
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 ...
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 ...
6
votes
Accepted
Matrix Transpose in Golang
In Go, measure performance. Run benchmarks using the Go testing package.
For example,
...
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.
...
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 ...
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 ...
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 ...
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 ...
5
votes
Google Translate CLI
In several places you use fmt.Println followed by os.Exit.
You may create your own Exit ...
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 ...
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:
...
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 ...
5
votes
Drawing a snowman in ASCII art
Cute project ;-)
Do you see where copy-paste coding got the better of you?
...
5
votes
Accepted
Quiz game with timer
startTimer()
The time package provides timers natively. So rather than using a call to ...
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 ...
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 ...
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, ...
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 ...
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, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
go × 581beginner × 114
concurrency × 69
performance × 52
algorithm × 35
http × 31
programming-challenge × 20
strings × 16
json × 16
file × 16
parsing × 15
unit-testing × 15
comparative-review × 15
io × 15
error-handling × 14
server × 14
multithreading × 13
csv × 12
rest × 12
formatting × 11
logging × 11
mongodb × 11
array × 10
sorting × 10
file-system × 10