all: replace logtail.{Public,Private}ID with logid.{Public,Private}ID (#7404)

The log ID types were moved to a separate package so that
code that only depend on log ID types do not need to link
in the logic for the logtail client itself.
Not all code need the logtail client.

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
Joe Tsai
2023-02-28 19:00:00 -08:00
committed by GitHub
parent d41f6a8752
commit 0d19f5d421
12 changed files with 38 additions and 36 deletions

View File

@@ -15,7 +15,7 @@ import (
"strings"
"time"
"tailscale.com/logtail"
"tailscale.com/types/logid"
)
func main() {
@@ -56,7 +56,7 @@ func main() {
log.Fatalf("logreprocess: read error %d: %s", resp.StatusCode, string(b))
}
tracebackCache := make(map[logtail.PublicID]*ProcessedMsg)
tracebackCache := make(map[logid.PublicID]*ProcessedMsg)
scanner := bufio.NewScanner(resp.Body)
for scanner.Scan() {
@@ -98,8 +98,8 @@ func main() {
type Msg struct {
Logtail struct {
Instance logtail.PublicID `json:"instance"`
ClientTime time.Time `json:"client_time"`
Instance logid.PublicID `json:"instance"`
ClientTime time.Time `json:"client_time"`
} `json:"logtail"`
Text string `json:"text"`
@@ -110,6 +110,6 @@ type ProcessedMsg struct {
ClientTime time.Time `json:"client_time"`
} `json:"logtail"`
OrigInstance logtail.PublicID `json:"orig_instance"`
Text string `json:"text"`
OrigInstance logid.PublicID `json:"orig_instance"`
Text string `json:"text"`
}

View File

@@ -12,6 +12,7 @@ import (
"os"
"tailscale.com/logtail"
"tailscale.com/types/logid"
)
func main() {
@@ -25,7 +26,7 @@ func main() {
log.SetFlags(0)
var id logtail.PrivateID
var id logid.PrivateID
if err := id.UnmarshalText([]byte(*privateID)); err != nil {
log.Fatalf("logtail: bad -privateid: %v", err)
}