From 4bbf5a86363a1dcaa47497c2580e59719c040310 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 15 Sep 2021 10:05:34 -0700 Subject: [PATCH] cmd/cloner: reduce diff noise when changing command Spelling out the command to run for every type means that changing the command makes for a large, repetitive diff. Stop doing that. Signed-off-by: Josh Bleecher Snyder --- cmd/cloner/cloner.go | 6 +++--- ipn/prefs_clone.go | 6 +++--- tailcfg/tailcfg_clone.go | 33 ++++++++++++--------------------- types/dnstype/dnstype_clone.go | 6 +++--- types/persist/persist_clone.go | 6 +++--- wgengine/filter/match_clone.go | 6 +++--- wgengine/wgcfg/clone.go | 9 ++++----- 7 files changed, 31 insertions(+), 41 deletions(-) diff --git a/cmd/cloner/cloner.go b/cmd/cloner/cloner.go index 6784f9dc4..b72cd1ea2 100644 --- a/cmd/cloner/cloner.go +++ b/cmd/cloner/cloner.go @@ -149,7 +149,8 @@ const header = `// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserve // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type %s; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type %s package %s @@ -178,8 +179,7 @@ func gen(buf *bytes.Buffer, imports map[string]struct{}, name string, typ *types writeRegen := func(format string, args ...interface{}) { fmt.Fprintf(regenBuf, format+"\n", args...) } - writeRegen("// A compilation failure here means this code must be regenerated, with command:") - writeRegen("// tailscale.com/cmd/cloner -type %s", *flagTypes) + writeRegen("// A compilation failure here means this code must be regenerated, with the command at the top of this file.") writeRegen("var _%sNeedsRegeneration = %s(struct {", name, name) name := typ.Obj().Name() diff --git a/ipn/prefs_clone.go b/ipn/prefs_clone.go index 610942d8d..1f95af91a 100644 --- a/ipn/prefs_clone.go +++ b/ipn/prefs_clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type Prefs; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type Prefs package ipn @@ -30,8 +31,7 @@ func (src *Prefs) Clone() *Prefs { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Prefs +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _PrefsNeedsRegeneration = Prefs(struct { ControlURL string RouteAll bool diff --git a/tailcfg/tailcfg_clone.go b/tailcfg/tailcfg_clone.go index eb955df15..2f2f63e96 100644 --- a/tailcfg/tailcfg_clone.go +++ b/tailcfg/tailcfg_clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode package tailcfg @@ -27,8 +28,7 @@ func (src *User) Clone() *User { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _UserNeedsRegeneration = User(struct { ID UserID LoginName string @@ -64,8 +64,7 @@ func (src *Node) Clone() *Node { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _NodeNeedsRegeneration = Node(struct { ID NodeID StableID StableNodeID @@ -108,8 +107,7 @@ func (src *Hostinfo) Clone() *Hostinfo { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _HostinfoNeedsRegeneration = Hostinfo(struct { IPNVersion string FrontendLogID string @@ -145,8 +143,7 @@ func (src *NetInfo) Clone() *NetInfo { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _NetInfoNeedsRegeneration = NetInfo(struct { MappingVariesByDestIP opt.Bool HairPinning opt.Bool @@ -172,8 +169,7 @@ func (src *Login) Clone() *Login { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _LoginNeedsRegeneration = Login(struct { _ structs.Incomparable ID LoginID @@ -213,8 +209,7 @@ func (src *DNSConfig) Clone() *DNSConfig { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _DNSConfigNeedsRegeneration = DNSConfig(struct { Resolvers []dnstype.Resolver Routes map[string][]dnstype.Resolver @@ -239,8 +234,7 @@ func (src *RegisterResponse) Clone() *RegisterResponse { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _RegisterResponseNeedsRegeneration = RegisterResponse(struct { User User Login Login @@ -264,8 +258,7 @@ func (src *DERPRegion) Clone() *DERPRegion { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _DERPRegionNeedsRegeneration = DERPRegion(struct { RegionID int RegionCode string @@ -291,8 +284,7 @@ func (src *DERPMap) Clone() *DERPMap { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _DERPMapNeedsRegeneration = DERPMap(struct { Regions map[int]*DERPRegion OmitDefaultRegions bool @@ -309,8 +301,7 @@ func (src *DERPNode) Clone() *DERPNode { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type User,Node,Hostinfo,NetInfo,Login,DNSConfig,RegisterResponse,DERPRegion,DERPMap,DERPNode +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _DERPNodeNeedsRegeneration = DERPNode(struct { Name string RegionID int diff --git a/types/dnstype/dnstype_clone.go b/types/dnstype/dnstype_clone.go index 049d91f94..6b9afa533 100644 --- a/types/dnstype/dnstype_clone.go +++ b/types/dnstype/dnstype_clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type Resolver; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type Resolver package dnstype @@ -22,8 +23,7 @@ func (src *Resolver) Clone() *Resolver { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Resolver +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _ResolverNeedsRegeneration = Resolver(struct { Addr string BootstrapResolution []netaddr.IP diff --git a/types/persist/persist_clone.go b/types/persist/persist_clone.go index cb91b76fa..60855ceec 100644 --- a/types/persist/persist_clone.go +++ b/types/persist/persist_clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type Persist; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type Persist package persist @@ -23,8 +24,7 @@ func (src *Persist) Clone() *Persist { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Persist +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _PersistNeedsRegeneration = Persist(struct { _ structs.Incomparable LegacyFrontendPrivateMachineKey key.MachinePrivate diff --git a/wgengine/filter/match_clone.go b/wgengine/filter/match_clone.go index 04874ddec..4b8dc299c 100644 --- a/wgengine/filter/match_clone.go +++ b/wgengine/filter/match_clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type Match; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type Match package filter @@ -25,8 +26,7 @@ func (src *Match) Clone() *Match { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Match +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _MatchNeedsRegeneration = Match(struct { IPProto []ipproto.Proto Dsts []NetPortRange diff --git a/wgengine/wgcfg/clone.go b/wgengine/wgcfg/clone.go index f8e10cece..e5193d82b 100644 --- a/wgengine/wgcfg/clone.go +++ b/wgengine/wgcfg/clone.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Code generated by tailscale.com/cmd/cloner -type Config,Peer; DO NOT EDIT. +// Code generated by the following command; DO NOT EDIT. +// tailscale.com/cmd/cloner -type Config,Peer package wgcfg @@ -29,8 +30,7 @@ func (src *Config) Clone() *Config { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Config,Peer +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _ConfigNeedsRegeneration = Config(struct { Name string PrivateKey wgkey.Private @@ -52,8 +52,7 @@ func (src *Peer) Clone() *Peer { return dst } -// A compilation failure here means this code must be regenerated, with command: -// tailscale.com/cmd/cloner -type Config,Peer +// A compilation failure here means this code must be regenerated, with the command at the top of this file. var _PeerNeedsRegeneration = Peer(struct { PublicKey wgkey.Key DiscoKey tailcfg.DiscoKey