profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/josharian/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

dvyukov/go-fuzz 4125

Randomized testing for Go

google/starlark-go 1371

Starlark in Go: the Starlark configuration language, implemented in Go

inetaf/netaddr 574

Network address types

dvyukov/go-fuzz-corpus 121

Corpus for github.com/dvyukov/go-fuzz examples

go4org/mem 83

cheap Go type to hold & operate on either a read-only []byte or string

josharian/compilecmp 24

automate Go compiler comparisons

josharian/2015-oscon-go-perf-tutorial 21

Slides and code for Go performance tutorial given at 2015 OSCON

pull request commenttailscale/tailscale

cmd/viewer: WIP

@dsnet this is the beginning of work on using views to ensure that netmaps are readonly outside the netmap package.

It's very, very raw: cmd/viewer compiles and runs, but doesn't generate code for maps. The code using it doesn't even come close to compiling.

Don't waste time reviewing it, except at most a quick peek; this is for future discussion.

josharian

comment created time in 2 days

PR opened tailscale/tailscale

cmd/viewer: WIP

Next up: view support for maps, etc.

+680 -60

0 comment

15 changed files

pr created time in 2 days

create barnchtailscale/tailscale

branch : josh/immutable-views

created branch time in 2 days

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha fb66ff7c786569fe068fdfe2d6ccb8b14c867218

util/codegen: add package This is a package for shared utilities used in doing codegen programs. The inaugural API is for writing gofmt'd code to a file. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 618376dbc03d703109c08d6302ade4c509c3cbb4

util/codegen: add AssertStructUnchanged Refactored out from cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha d5ab18b2e62760ab2870e3909c15f11e6ece3dca

cmd/cloner: add Clone context to regen struct assignments Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 081be3e96b5c3983e0c1818b31730aa977a811f1

cmd/cloner: simplify code Change from a single-case type switch to a type assertion with an early return. That exposes that the name arg to gen is unneeded. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 367a973dc224910a4e31ed58a0a961076c280e8a

cmd/cloner: delete some debug code Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha d8a8f700007a67fc369af17c1e4c157754436977

util/codegen: add NamedTypes And use it in cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha d5a0a4297e55adf77d7585f16caeae62c6d16cae

cmd/cloner: unify switch cases And in the process, fix a bug: The fmt formatting was being applied by writef, not fmt.Sprintf, thus emitting a MISSING string. And there's no guarantee that fmt will be imported in the generated code. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 3cd85c0ca6bd4c29195e71fae4015b2ad89b555b

util/codegen: add ContainsPointers And use it in cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha b14db5d943b84be3c9f3a909c18c9af4012523dd

util/codegen: reorder AssertStructUnchanged args The fully qualified name of the type is thisPkg.tname, so write the args like that too. Suggested-by: Joe Tsai <joetsai@digital-static.net> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 2 days

delete branch tailscale/tailscale

delete branch : josh/cloner-codegen

delete time in 2 days

PR merged tailscale/tailscale

util/codegen, cmd/cloner: organize and simplify cloner
  • util/codegen: add package
  • util/codegen: add AssertStructUnchanged
  • cmd/cloner: add Clone context to regen struct assignments
  • cmd/cloner: simplify code
  • cmd/cloner: delete some debug code
  • util/codegen: add NamedTypes
  • cmd/cloner: unify switch cases
  • util/codegen: add ContainsPointers
+243 -177

4 comments

8 changed files

josharian

pr closed time in 2 days

Pull request review commenttailscale/tailscale

util/codegen, cmd/cloner: organize and simplify cloner

 func WriteFormatted(code []byte, path string) error { 	} 	return nil }++// AssertStructUnchanged generates code that asserts at compile time that type t is unchanged.+// tname is the named type corresponding to t.+// ctx is a single-word context for this assertion, such as "Clone".+// thisPkg is the package containing t.+// If non-nil, AssertStructUnchanged will add elements to imports+// for each package path that the caller must import for the returned code to compile.+func AssertStructUnchanged(t *types.Struct, tname, ctx string, thisPkg *types.Package, imports map[string]struct{}) []byte {

Done. Did it as an additional commit to avoid pointless merge pain.

josharian

comment created time in 2 days

PullRequestReviewEvent

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha 538003cc1f3ba29962b0ead4b9873ab87a50b971

util/codegen: reorder AssertStructUnchanged args The fully qualified name of the type is thisPkg.tname, so write the args like that too. Suggested-by: Joe Tsai <joetsai@digital-static.net> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 2 days

pull request commenttailscale/tailscale

util/codegen, cmd/cloner: organize and simplify cloner

Just wanted to comment that a few weeks ago I was exploring how to make the cloner logic nicer with the use of generics.

Cool, SGTM.

I'd also like to make the logic a bit less one-off: Instead of panicking on pointers-to-pointers, it should do recursive codegen and (as a consequence) handle a broader swath of types. Sounds scary, but in practice probably quite straightforward. But not urgent, either.

Happy to work with you on either/both of those efforts. I'll put up a WIP PR for cmd/viewer once this one is in so you can see what I'm up to there.

josharian

comment created time in 2 days

Pull request review commenttailscale/hujson

Deprecate fork of "encoding/json"

 # HuJSON - Human JSON -The HuJSON decoder is a JSON decoder that also allows--- comments, both `/* ... */` and `// to end of line`-- trailing commas on arrays and object members--It is a soft fork of the Go standard library `encoding/json` package.-The plan is to merge in all changes from each Go release.--Currently HuJSON is based on Go 1.13.--## Grammar--The changes to the [JSON grammar](https://json.org) are:--```---- grammar.json-+++ grammar.hujson-@@ -1,13 +1,31 @@- members- 	member-+	member ',' ws- 	member ',' members- - elements- 	element-+	element ',' ws- 	element ',' elements- -+comments-+	"*/"-+	comment comments-+-+comment-+	'0000' . '10FFFF'-+-+linecomments-+	'\n'-+	linecomment linecomments-+-+linecomment-+	'0000' . '10FFFF' - '\n'-+- ws- 	""-+	"/*" comments-+	"//" linecomments- 	'0020' ws- 	'000A' ws- 	'000D' ws-```+The HuJSON format is an extension of standard JSON (RFC 8259) that permits+C-style line comments and block comments intermixed with whitespace.+It allows trailing commas after the last member/element in an object/array.

s/It allows/It also allows/

Or:

"...intermixed with whitespace, and allows..."

dsnet

comment created time in 2 days

Pull request review commenttailscale/hujson

Deprecate fork of "encoding/json"

+// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.+// Use of this source code is governed by a BSD-style+// license that can be found in the LICENSE file.++package hujson++import (+	"bytes"+	"io"++	json "github.com/tailscale/hujson/internal/hujson"+)++// Deprecated: Do not use. This will be deleted in the near future.

It'd be nice to provide a reason after "Deprecated:", per the standard at https://github.com/golang/go/wiki/Deprecated. Something like "Deprecated: This has been replaced by XXX and will be deleted soon."

dsnet

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha a16ade762b61794e3cfe3280160e055da66ad9f6

util/codegen: add package This is a package for shared utilities used in doing codegen programs. The inaugural API is for writing gofmt'd code to a file. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 9cf4d29ac16bd253d2b3ca81e6123f34f5179533

util/codegen: add AssertStructUnchanged Refactored out from cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 91e902026387a3d34b98fd8c95337195e337c0e5

cmd/cloner: add Clone context to regen struct assignments Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 32b596f2ecdfbb8a55f9e052faea3c4d970bf2fd

cmd/cloner: simplify code Change from a single-case type switch to a type assertion with an early return. That exposes that the name arg to gen is unneeded. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 32ddf2932aba57099d732be92ea8295dbfa970ee

cmd/cloner: delete some debug code Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha c89abd547b82f55aa350b9588b8f24b63a287b2f

util/codegen: add NamedTypes And use it in cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 50876ee3375441d16b4b199668d2cb8660d410ac

cmd/cloner: unify switch cases And in the process, fix a bug: The fmt formatting was being applied by writef, not fmt.Sprintf, thus emitting a MISSING string. And there's no guarantee that fmt will be imported in the generated code. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha fcb5c098ff7c2f402674d1387ab5b1de179ddb8c

util/codegen: add ContainsPointers And use it in cmd/cloner. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 2 days

pull request commenttailscale/tailscale

util/codegen, cmd/cloner: organize and simplify cloner

I am in the process of hacking up a cmd/viewer, similar to cmd/cloner, but that generates readonly views rather than copies. It shares a lot of code and structure with cmd/cloner. This PR is preliminary work on cloner, cleaning up the code a bit and extracting some obviously re-usable parts.

Review commit-by-commit for best effect.

josharian

comment created time in 2 days

create barnchtailscale/tailscale

branch : josh/cloner-codegen

created branch time in 2 days

PR opened tailscale/tailscale

util/codegen, cmd/cloner: organize and simplify cloner
  • util/codegen: add package
  • util/codegen: add AssertStructUnchanged
  • cmd/cloner: add Clone context to regen struct assignments
  • cmd/cloner: simplify code
  • cmd/cloner: delete some debug code
  • util/codegen: add NamedTypes
  • cmd/cloner: unify switch cases
  • util/codegen: add ContainsPointers
+238 -177

0 comment

8 changed files

pr created time in 2 days

issue commenttailscale/tailscale

cmd/tailscaled: tracking bug for ongoing log leveling work

@kgersen a bit more detail would be useful to see why those particular lines are occurring so much for you. Would you run tailscale bugreport and give me the bug report identifier? Thanks.

bradfitz

comment created time in 2 days

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha 221cc5f8f20ca0621bb0cbc70f318505bcb47928

ipn/ipnlocal: reduce line noise in tests Use helpers and variadic functions to make the call sites a lot easier to read, since they occur a lot. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha f834a4ade53dcd8adaac118f72e6f1a288eab710

ipn/ipnlocal: fix minor typo in comment Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 07c09f470d66f0ffa6689c3362c2e3f898e48a27

ipn/ipnlocal: do not shut down the backend halfway through TestStateMachine LocalBackend.Shutdown's docs say: > The backend can no longer be used after Shutdown returns. Nevertheless, TestStateMachine blithely calls Shutdown, talks some smack, and continues on, expecting things to work. Other uses of Shutdown in the codebase are as intended. Things mostly kinda work anyway, except that the wgengine.Engine has been shut down, so calls to Reconfig fail. Those get logged: > local.go:603: wgengine status error: engine closing; no status but otherwise ignored. However, the Reconfig failure caused one fewer call to pause/unpause than normal. Now the assertCalls lines match the equivalent ones earlier in the test. I don't see an obvious correct replacement for Shutdown in the context of this test; I'm not sure entirely what it is trying to accomplish. It is possible that many of the tests remaining after the prior call to Shutdown are now extraneous. They don't harm anything, though, so err on the side of safety and leave them for now. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha a722e48cef1beb434afd1c83cc9097efd8b5fe7d

wgengine/magicsock: skip alloc test with -race Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 2 days

delete branch tailscale/tailscale

delete branch : josh/ipnlocal-cont

delete time in 2 days

PR merged tailscale/tailscale

ipn/ipnlocal: minor cleanup
  • ipn/ipnlocal: reduce line noise in tests
  • ipn/ipnlocal: fix minor typo in comment
  • ipn/ipnlocal: do not shut down the backend halfway through TestStateMachine
  • wgengine/magicsock: skip alloc test with -race
+51 -59

3 comments

3 changed files

josharian

pr closed time in 2 days

pull request commenttailscale/tailscale

ipn/ipnlocal: minor cleanup

It was a draft only because of the test failures, which turned out to be unrelated. Thanks for the review.

josharian

comment created time in 2 days

push eventtailscale/tailscale

Maxim Merzhanov

commit sha d43fcd2f022293e6db61fa2241263432e2a732e6

net/dns: fix error wrapping for SetLinkDefaultRoute in resolved Signed-off-by: Maxim Merzhanov <maksimmerzh@gmail.com>

view details

Brad Fitzpatrick

commit sha 73f177e4d5a9dcc2c5282ad20140af6236b205d8

derp: throttle client sends if server advertises rate limits Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>

view details

Brad Fitzpatrick

commit sha 4549d3151ca6be7c7364717a37f94652d07a1ee0

cmd/tailscale: make status show health check problems Fixes #2775 RELNOTE=tailscale status now shows health check problems Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>

view details

Brad Fitzpatrick

commit sha a05086ef86d05c1dd6f07dc15459d55557cf795f

portlist: add debug knob to disable portlist collection For big servers. Per discussion with @crawshaw. Updates tailscale/corp#2566 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>

view details

Josh Bleecher Snyder

commit sha bf9e04b2508243f6ba4c3637d9ce39ccb1b8042b

ipn/ipnlocal: reduce line noise in tests Use helpers and variadic functions to make the call sites a lot easier to read, since they occur a lot. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 8dba89792c7ca6b3ff95c6fbf4052509b8df9c5d

ipn/ipnlocal: fix minor typo in comment Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 30a10970093b2187dc387cda84cc9ee8b3551159

ipn/ipnlocal: do not shut down the backend halfway through TestStateMachine LocalBackend.Shutdown's docs say: > The backend can no longer be used after Shutdown returns. Nevertheless, TestStateMachine blithely calls Shutdown, talks some smack, and continues on, expecting things to work. Other uses of Shutdown in the codebase are as intended. Things mostly kinda work anyway, except that the wgengine.Engine has been shut down, so calls to Reconfig fail. Those get logged: > local.go:603: wgengine status error: engine closing; no status but otherwise ignored. However, the Reconfig failure caused one fewer call to pause/unpause than normal. Now the assertCalls lines match the equivalent ones earlier in the test. I don't see an obvious correct replacement for Shutdown in the context of this test; I'm not sure entirely what it is trying to accomplish. It is possible that many of the tests remaining after the prior call to Shutdown are now extraneous. They don't harm anything, though, so err on the side of safety and leave them for now. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 878936bfb20425116ee7fd16dffc42c8718a07be

wgengine/magicsock: skip alloc test with -race Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 3 days

PullRequestReviewEvent

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha b7ede1439690b1f0f416bcddba3eb3bb2eeda3c7

Revert "ipn/ipnlocal: remove locks around sync.Cond.Broadcast call" Reason for revert: Causes ipnlocal tests to deadlock intermittently. This reverts commit 1b15349e011a14a54e1a0b0f613df47bb2898d6f. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

Josh Bleecher Snyder

commit sha 45d3174c0deafa061cb407c64d25d2c69679cb58

ipn/ipnlocal: add LocalBackend.broadcastStatusChanged To reduce repetition. Also, document why we acquire the lock. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 3 days

delete branch tailscale/tailscale

delete branch : josh/ipnlocal-lock-cond

delete time in 3 days

PR merged tailscale/tailscale

Reviewers
ipnlocal: fix sync.Cond-related test flakiness
  • Revert "ipn/ipnlocal: remove locks around sync.Cond.Broadcast call"
  • ipn/ipnlocal: add LocalBackend.broadcastStatusChanged
+13 -3

5 comments

1 changed file

josharian

pr closed time in 3 days

pull request commenttailscale/tailscale

ipnlocal: fix sync.Cond-related test flakiness

PTAL

josharian

comment created time in 3 days

push eventtailscale/tailscale

Josh Bleecher Snyder

commit sha eecc9a9d21c18be7d8a9440b3dd29de11349071d

ipn/ipnlocal: add LocalBackend.broadcastStatusChanged To reduce repetition. Also, document why we acquire the lock. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>

view details

push time in 3 days