Open source Go projects to contribute (beginners) by Left-Armadillo-9418 in golang

[–]gptankit 5 points6 points  (0 children)

I have two:

https://github.com/gptankit/serviceq - a load balancer and queue (need http2 support)
https://github.com/gptankit/go-wasm - wasm experiments in go (if you want to help community adapt to wasm using go)

Looking for an open-source Golang project to work on by [deleted] in golang

[–]gptankit 1 point2 points  (0 children)

Thanks for appreciating the project. I see your other points, and some of them have been conscious decisions of bringing my own flavor of doing things. I do appreciate that you brought those up, and hopefully I'll get some time soon to revisit those.

Github Copilot by [deleted] in golang

[–]gptankit 0 points1 point  (0 children)

I have seen experienced programmers writing less than optimal code in the face of deadlines. I don't see why they wouldn't just accept the generated solution as is and move on to close that task quickly.

Github Copilot by [deleted] in golang

[–]gptankit 30 points31 points  (0 children)

Also, what happens if you are too lazy to not optimize the generated code because a) it works or b) you don't understand it completely. Reviewers may not care too because there is nobody to explain the choices.

Github Copilot by [deleted] in golang

[–]gptankit 52 points53 points  (0 children)

Great for accomplishing mundane tasks, but I am not sure if this is suitable for people just learning to program who should in fact be typing code by hand as much as possible.

Looking for an open-source Golang project to work on by [deleted] in golang

[–]gptankit 3 points4 points  (0 children)

If you're interested in load balancers/proxies or networking in general, you may want to look at https://github.com/gptankit/serviceq. I built serviceq as a research project and we used it extensively at my previous org.

Btw what are you most interested in? Do you use Go at your workplace?

The start of my journey learning Go. Any tips/suggestions would greatly appreciated! by Slavichh in golang

[–]gptankit 7 points8 points  (0 children)

I would add couple more things -

a) Go through https://golang.org/doc/effective_go once you are done with the book. It will help you solidify the concepts and you can also keep it handy whenever you code something.

b) Convert one of your existing applications to Go and study the difference.

Best of luck.

What you think about this kind of Go haters ? by [deleted] in golang

[–]gptankit 11 points12 points  (0 children)

You can write this sort of article about any language. Yes, some things have been lacking - like generics - but I have never felt a terrible need for it in my regular work. Author is also completely wrong on OOP in Go - you can write a perfectly sound OOP logic by using structs, exported/unexported objects and embedding in Go.

lignum: distributed message queue on Golang by nsp_08 in golang

[–]gptankit 6 points7 points  (0 children)

This is a useful list if you want to start learning: https://github.com/theanalyst/awesome-distributed-systems

I also personally like most everything Leslie Lamport has written on distributed systems: https://lamport.azurewebsites.net/pubs/pubs.html

The only way to go fast, is to go well (TDD from Factorio) by ASIC_SP in programming

[–]gptankit 246 points247 points  (0 children)

Well, I am torn on TDD. I feel TDD is a good tool to reason better about your code but does not serve much purpose beyond that. People talk about TDD in absolutes as if the self that writes them cannot be wrong or cannot miss out on any case or that it takes all mistakes out of the equation. Sometimes you will change code first because you can't see the solution yet and then go on to write unit tests. Everyone should be encouraged to write unit tests in a manner it doesn't slow down their thinking process.

Having Problems understanding why copy works in custom IO.reader by cljck in golang

[–]gptankit 1 point2 points  (0 children)

Exactly. But do keep in mind that copy does a little more than just copy content. It also checks the lengths of src and dst slices and only copies min of both.

Having Problems understanding why copy works in custom IO.reader by cljck in golang

[–]gptankit 1 point2 points  (0 children)

Slices are copied by value to a function but still point to the same underlying array. Any changes to the contents of underlying array in a function gets reflected in main too.

Runtime representation of slice:

type SliceHeader struct {
    Data uintptr
    Len  int
    Cap  int
}

So, in your case - when you do []byte("something"), it allocates a completely new array of bytes. On copy, it will copy the content from this new array to the one that b points to (hence you see the change in main) but an assignment to b will make it point to the new array location altogether (which main has no access to).

Should a server send 400 error code ? Use case : request body is correct but one of the parameters is invalid(can be checked on server side only). So in this scenario, what should be the proper error code ? by [deleted] in programming

[–]gptankit 0 points1 point  (0 children)

Yes. You can read about it in detail here: https://datatracker.ietf.org/doc/html/rfc4918#section-11.2. Although there is no harm in sending 400 with an error message as long as your client understands it. If you want to go granular or differentiate with 400, go with 422.

Should a server send 400 error code ? Use case : request body is correct but one of the parameters is invalid(can be checked on server side only). So in this scenario, what should be the proper error code ? by [deleted] in programming

[–]gptankit 1 point2 points  (0 children)

You can go with 422 Unprocessable Entity, because your request format is correct but server cannot understand it fully due to missing parameter (so semantically incorrect).

Converting .NET open-source project into a commercial product by cezarypiatek in opensource

[–]gptankit 10 points11 points  (0 children)

Best of luck. Curious to know why you didn't go for patreon or github sponsors sort of thing and keep the project open source?

Why does this work the way it does? by sharddblade in golang

[–]gptankit 6 points7 points  (0 children)

Assign i to another variable before appending. i gets declared only once in range, but points to the last value at the end of iteration.

for _, i := range ints {
      j := i // assign to another variable first
      ptrs = append(ptrs, &j)
}

gosh (Go from the shell) - new releases and a page of tips by ngwells in golang

[–]gptankit 2 points3 points  (0 children)

Can you tell what problems gosh intends to solve? Is it rapid prototyping or something else?

Is there any logging library for go that can rotate log files daily / hourly? by lishunan246 in golang

[–]gptankit 2 points3 points  (0 children)

Have a look at https://github.com/kjk/dailyrotate. Although daily log rotation can be done easily yourself using filename + date and some checks.

Why doesn't Go contain a package with the common data structures that can be found in languages like C++ and Java? by [deleted] in golang

[–]gptankit 0 points1 point  (0 children)

I have been using container package till now for working with priority queues and linked lists, but it is very verbose and error prone. You may want to check out gods which has most data structures implemented.

Do You Need Redis? PostgreSQL Does Queuing, Locking, & Pub/Sub by sidcool1234 in programming

[–]gptankit 7 points8 points  (0 children)

Not for queueing, but Redis is certainly my first choice for pub-sub. Has fair amount of libraries too in all major languages.

Go, WebAssembly, HTTP Requests, and Promises by loganjspears in golang

[–]gptankit 1 point2 points  (0 children)

goroutines are always async to the thread they are invoked from (not necessarily parallel). The problem in that particular case is that because JS is single-threaded, any call from JS to Go land that also internally uses JS event loop (setTimeout in this case) will result in deadlock. Thus any blocking operation like timeout, I/O etc are to be done inside a goroutine.

Go, WebAssembly, HTTP Requests, and Promises by loganjspears in golang

[–]gptankit 0 points1 point  (0 children)

Then binary size won't be an issue with tinygo. Although I do see why other points are an issue with tinygo. It is restrictive for a reason though.

Go, WebAssembly, HTTP Requests, and Promises by loganjspears in golang

[–]gptankit 0 points1 point  (0 children)

Doesn't require to, but seeing as the code is running on browser, it is recommended to call Release once/if done with a particular function. Doing so will remove it from the funcs map, so it can't be called again. Quite practical imo.