Earlier quoted context omitted.
JetBrains WebStorm with the free Go plug-in provides an excellent Go IDE experience. There are some free community editions of JetBrains IDEs that are supposed to work with the Go plug-in (e.g. PyCharm, if I’m not wrong), so you do not even have to pay anything. https://www.jetbrains.com/products.html?fromMenu#type=ide
It is not excellent. All other editors I used autoformat Go code after save. There are two types of format provided by IDEA - IDE Format & go fmt. Both not ideal. IDE Format does not format code according go guidelines. It can delete unused imports if you go through options. go fmt does not delete unused imports, and as result code is not compileble. Refactorings are missing in IDEA. It is not excellent, it is someth…
I’m joining the Go team at Google
181–190 of 211 posts
Re: I’m joining the Go team at Google
#182Earlier quoted context omitted.
> functions which are known to never be checked for their errors, like fmt.Println In Java println is checked for errors, as it should be. Every Java program that does println either aborts or deals with the error in some way. It matters. Take any program that writes to stdout and run it with ">&-" to close stdout. Because of unix, the next file it opens will be file descriptor 1 and the program will start writing th…
I tried your example, and observed an error: write /dev/stdout: bad file descriptor What "next file it opens" are you talking about exactly? How does what you're describing work?
Example:
#include
int main(int argc, char **argv) {
printf("first message\n");
fflush(stdout);
fopen("output", "w");
printf("second message\n");
fflush(stdout);
}
Output: # ./a.out
first message
second message
# ./a.out 1>&-
# cat output
second message
By ignoring the error, the program continued on and then wrote console output messages to the file after it was opened. There have been exploits due to this bug, but the real point is that you could never predict this failure without good knowledge of unix and careful consideration. This is why error codes should not be cavalierly ignored, because it's really hard to know what might happen if you do.Last I checked, Go operates the same way as this C example. Java fails on the "first message" if stdout is closed so it doesn't trash the file, not because they even specifically thought of this scenario but just because errors are not ignored by default and are not easy to ignore.
Re: I’m joining the Go team at Google
#183Earlier quoted context omitted.
> Go is not a C replacement/better C. Its not a replacement for C in most of the places where C is far and away the best existing choice for a whole project, it is a replacement for C in the zone where C's performance and static typing are attractive and would decided the choice in its favor, but Python's expressiveness, batteries-included stdlib, etc. also make it attractive and make it a little bit painful that the…
Sure, but in those cases Java/Swift/C#/etc are also reasonable replacements. If you're not taking advantage of data locality then it's possible to approach C's performance in any of those languages. If your primary concern is performance(which is the only reason I'd reach for C today, esp w/ security concerns) then Go is not going to replace C in that domain.
Re: I’m joining the Go team at Google
#184Earlier quoted context omitted.
I'm assuming Lombok and using the new Lambdas. Maybe even a fibers library.
Yep, mostly Lombok (especially @Data for immutable typed objects with automatic constructors without boilerplate), streams, and lambdas.
Re: I’m joining the Go team at Google
#185Earlier quoted context omitted.
I watched this, and what I saw was a heck of a lot of information about how to extract information from error values and percolate them together up to a handler, all of which would automatically be present in your everyday stack trace in a language that actually threw unexpected runtime errors. ;) I frankly don't see how this is OK, nor better. Errors are real in the sense that they are evidence that the programmer's…
I don't think the original Go authors ever truly thought that exceptions are "bad" per se. I think they just took it off the table because of the complexity it added to the language, both conceptually and implementation wise. A (the?) primary main goal of Go from the beginning has always been to make implementation as obvious as possible; in other words, to make it a slightly thicker layer on top of assembly than C w…
On top of that, unwinding isn't the only way to get something where errors have to be handled or the program dies. Look at Swift's error handling for example: it's basically sugar over returned errors with correctness checks. Dead simple implementation, and dead simple to explain to users.
What I don't buy about the justifications for Go's design is that they were driven by the pure guiding hand of simplicity. It looks more to me like the designers simply treated language features they had seen done badly before as anathema and didn't try to think about how the mistakes could be corrected.
Re: I’m joining the Go team at Google
#186Re: I’m joining the Go team at Google
#187Earlier quoted context omitted.
I'm assuming Lombok and using the new Lambdas. Maybe even a fibers library.
Yep, mostly Lombok (especially @Data for immutable typed objects with automatic constructors without boilerplate), streams, and lambdas.
its hard to find good examples of this style of coding. For example, it is hard to figure out which app server (Spring Boot, undertow, dropwizard, wildfly). I'm sure you can use any... but it would be nice to learn from your experiences.
Re: I’m joining the Go team at Google
#188Earlier quoted context omitted.
Sure, but in those cases Java/Swift/C#/etc are also reasonable replacements. If you're not taking advantage of data locality then it's possible to approach C's performance in any of those languages. If your primary concern is performance(which is the only reason I'd reach for C today, esp w/ security concerns) then Go is not going to replace C in that domain.
Swift probably, but Java and C# still suffer in a lot of situations from the lack of good AOT compilation options. There are implementations for both, but they're incredibly primitive compared to the JIT reference implementations.
Re: I’m joining the Go team at Google
#189Earlier quoted context omitted.
Dave Cheney gave a talk about error handling in Go that sheds some light on how the Go community thinks about errors: https://www.youtube.com/watch?v=lsBF58Q-DnY
I watched this, and what I saw was a heck of a lot of information about how to extract information from error values and percolate them together up to a handler, all of which would automatically be present in your everyday stack trace in a language that actually threw unexpected runtime errors. ;) I frankly don't see how this is OK, nor better. Errors are real in the sense that they are evidence that the programmer's…
Re: I’m joining the Go team at Google
#190Earlier quoted context omitted.
>Sorry, but in what way is Go "revolutionizing"? By offering simplicity. Taking a step back to before C++. And providing a better C. C + strings + GC + map + slice(array) + json/xml parsing + http transport layer (server & client). What else do you need ? Ideal for minimalists. That's its beauty. Programs are very stable. Takes less memory than Java (some amount more than C/C++). Faster compilation time compared to C…
> By offering simplicity. Taking a step back to before C++. And providing a better C. C + strings + GC + map + slice(array) + json/xml parsing + http transport layer (server & client). What else do you need? Language consistency (no magical functions like "make" or magical items like slices), DRYness (generics), better type-safety than C (interface{} is the void * of the 21st century), would be a good start. Due to t…
After posting, I realized its concurrent programming model, is another thing which I (and many others) am a fan of. I found the channel and go based approach, much better compared to explicit spawning of threads in languages like Java and C++.