News for hackers. Stuff that matters.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by roguecoder on Tuesday November 28, 2017 @12:32PM (#15799358)
Is it common in Golang to not write tests?
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by pokstad on Tuesday November 28, 2017 @12:35PM (#15799388)
No, tests are commonly in the same package as the implementation.

I did find this one: https://github.com/tenta-browser/tenta-dns/blob/master/src/t...

That's an internal test, meaning it has access to the package internals. A better test would test from outside the boundaries of the package to only interact with exposed symbols.

Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by alpb on Tuesday November 28, 2017 @12:37PM (#15799414)
Oh lordy, that log.SetLogLevel() has effects outside the test code.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by tenta on Tuesday November 28, 2017 @12:45PM (#15799488)
Setting the log level has effects, but only on an internal wrapper package that neatly zips up the nitty gritty of setting up the logger.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by sagichmal on Tuesday November 28, 2017 @07:34PM (#15803431)
Package-level loggers are an antipattern :(
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by tptacek on Tuesday November 28, 2017 @03:31PM (#15801189)
Certainly it's common to write fewer tests than Python or Ruby projects, where you need tests to verify basic type and existence assertions.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by pvg on Tuesday November 28, 2017 @06:17PM (#15802909)
This is starting to change, perhaps not in Ruby but JS and Python now have commonly-used pre-compile typecheckers with typesystems fancier than your typical typed C-descendant language, annotation stubs for the standard or popular libraries, etc. I wouldn't be surprised that if in a couple of years, the default for a new Javascript project would be more typechecked than Go, strange as it is to say.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by tptacek on Tuesday November 28, 2017 @06:46PM (#15803147)
Sure! I think that's especially true of Javascript.

I would just caution people against doing direct comparisons of unit test suites between Ruby/Python and Go projects, because a lot of Ruby/Python testing really just mitigates deficiencies in those languages, and those deficiencies have created a sort of culture of exuberant, creative testing that isn't present in other languages.

Tests are good! Everything should have tests.

Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by fulafel on Friday December 01, 2017 @01:20AM (#15822298)
I know only of Flow for JS, but are there signs that it's commonly used, or are there other JS typecheckers with a more optimistic trajectory?

It looks to me more like compile-to-JS languages are winning this race. Which is good, as it enables sthings like ClojureScript and Elm. Also many of us think the lack of static types is the least of the problems in JS.

Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by pvg on Monday December 04, 2017 @12:39AM (#15841708)
Flow and TypeScript are used a fair bit and both have adoption in big organizations that make big, commonly used tools. I don't think any of the compile-to-JS languages have ever really got quite that far and I'm somewhat skeptical they will.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by fulafel on Tuesday December 05, 2017 @12:42AM (#15849993)
Ah. I guess due to the superset-of-JS property you might kinda sorta see it as annotated JS, though it has its own syntax and has to go through a compiler to produce runnable JS.

edit: Seems the TS tools also have JS linting functionality, where you put JSDoc annotations in comments and use the new --checkJs options, I guess you may have meant this too.

Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by ubernostrum on Wednesday November 29, 2017 @05:26AM (#15805865)
I don't know how many times I've written that kind of test, but I'd bet I can count them in base-10 with just my fingers.
Re:Show HN: Golang DNS server, including DNSSEC and DNS-over... by tenta on Tuesday November 28, 2017 @12:48PM (#15799515)
Some parts have unit tests. In addition, the "stresser" component, runs a resolve on the top million domain names, and we run this on every push on our development fork. This provides a real workout. We certainly need to produce a library of example wire data and expected responses. This would be a great contribution that we'd love to incorporate.