mirror of https://github.com/tailscale/tailscale/
feature/featuretags: make QR codes modular (#18358)
QR codes are used by `tailscale up --qr` to provide an easy way to open a web-page without transcribing a difficult URI. However, there’s no need for this feature if the client will never be called interactively. So this PR adds the `ts_omit_qrcodes` build tag. Updates #18182 Signed-off-by: Simon Law <sfllaw@tailscale.com>pull/16743/merge
parent
6aac87a84c
commit
3e45e5b420
@ -0,0 +1,22 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"tailscale.com/tstest/deptest"
|
||||
)
|
||||
|
||||
func TestOmitQRCodes(t *testing.T) {
|
||||
const msg = "unexpected with ts_omit_qrcodes"
|
||||
deptest.DepChecker{
|
||||
GOOS: "linux",
|
||||
GOARCH: "amd64",
|
||||
Tags: "ts_omit_qrcodes",
|
||||
BadDeps: map[string]string{
|
||||
"github.com/skip2/go-qrcode": msg,
|
||||
},
|
||||
}.Check(t)
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Code generated by gen.go; DO NOT EDIT.
|
||||
|
||||
//go:build ts_omit_qrcodes
|
||||
|
||||
package buildfeatures
|
||||
|
||||
// HasQRCodes is whether the binary was built with support for modular feature "QR codes in tailscale CLI".
|
||||
// Specifically, it's whether the binary was NOT built with the "ts_omit_qrcodes" build tag.
|
||||
// It's a const so it can be used for dead code elimination.
|
||||
const HasQRCodes = false
|
||||
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Code generated by gen.go; DO NOT EDIT.
|
||||
|
||||
//go:build !ts_omit_qrcodes
|
||||
|
||||
package buildfeatures
|
||||
|
||||
// HasQRCodes is whether the binary was built with support for modular feature "QR codes in tailscale CLI".
|
||||
// Specifically, it's whether the binary was NOT built with the "ts_omit_qrcodes" build tag.
|
||||
// It's a const so it can be used for dead code elimination.
|
||||
const HasQRCodes = true
|
||||
@ -0,0 +1,22 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package qrcodes
|
||||
|
||||
// Format selects the text representation used to print QR codes.
|
||||
type Format string
|
||||
|
||||
const (
|
||||
// FormatAuto will format QR codes to best fit the capabilities of the
|
||||
// [io.Writer].
|
||||
FormatAuto Format = "auto"
|
||||
|
||||
// FormatASCII will format QR codes with only ASCII characters.
|
||||
FormatASCII Format = "ascii"
|
||||
|
||||
// FormatLarge will format QR codes with full block characters.
|
||||
FormatLarge Format = "large"
|
||||
|
||||
// FormatSmall will format QR codes with full and half block characters.
|
||||
FormatSmall Format = "small"
|
||||
)
|
||||
@ -0,0 +1,16 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build ts_omit_qrcodes
|
||||
|
||||
package qrcodes
|
||||
|
||||
import "io"
|
||||
|
||||
func Fprintln(w io.Writer, format Format, s string) (n int, err error) {
|
||||
panic("omitted")
|
||||
}
|
||||
|
||||
func EncodePNG(s string, size int) ([]byte, error) {
|
||||
panic("omitted")
|
||||
}
|
||||
Loading…
Reference in New Issue