From 5b948f94d2000c77cd9bae085123eb27b8188125 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Wed, 8 Mar 2023 13:34:45 -0800 Subject: [PATCH] Update dev to v39 (#216) * Update dev to v39 * Updates Go to v1.19 * Reuse just-cargo in justfile * remove gross dependency scripts * fixup --- .devcontainer/devcontainer.json | 38 +++++---- .github/workflows/actions.yml | 25 +----- .github/workflows/go.yml | 2 +- .github/workflows/release.yml | 6 +- .github/workflows/rust.yml | 8 +- go.mod | 2 +- go/destination/destination.pb.go | 8 +- go/http_route/http_route.pb.go | 5 ++ go/http_types/http_types.pb.go | 2 + go/inbound/inbound.pb.go | 7 +- go/inbound/inbound_grpc.pb.go | 8 +- go/meta/meta.pb.go | 1 + go/net/net.pb.go | 1 + go/outbound/outbound.pb.go | 10 +++ go/tap/tap.pb.go | 9 ++ justfile | 141 +++---------------------------- 16 files changed, 91 insertions(+), 182 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4d169764b..3fb58524c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,22 +1,26 @@ { "name": "linkerd2-proxy-api", - "image": "ghcr.io/linkerd/dev:v32", - "extensions": [ - "DavidAnson.vscode-markdownlint", - "golang.go", - "kokakiwi.vscode-just", - "NathanRidley.autotrim", - "rust-lang.rust-analyzer", - "samverschueren.final-newline", - "tamasfe.even-better-toml", - "zxh404.vscode-proto3" - ], - "settings": { - "protoc": { - "path": "/usr/local/bin/protoc", - "options": [ - "--proto_path=proto", - ] + "image": "ghcr.io/linkerd/dev:v39", + "customizations": { + "vscode": { + "extensions": [ + "DavidAnson.vscode-markdownlint", + "golang.go", + "kokakiwi.vscode-just", + "NathanRidley.autotrim", + "rust-lang.rust-analyzer", + "samverschueren.final-newline", + "tamasfe.even-better-toml", + "zxh404.vscode-proto3" + ], + "settings": { + "protoc": { + "path": "/usr/local/bin/protoc", + "options": [ + "--proto_path=proto", + ] + } + } } }, "runArgs": [ diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 43d1793d3..6c4a67f40 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -13,31 +13,14 @@ jobs: actionlint: runs-on: ubuntu-latest timeout-minutes: 10 - container: ghcr.io/linkerd/dev:v32-tools steps: + - uses: linkerd/dev/actions/setup-tools@v39 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - name: Run actionlint - run: | - # shellcheck disable=SC2016 - actionlint \ - -format '{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}}::{{$err.Message}}%0A```%0A{{replace $err.Snippet "\\n" "%0A"}}%0A```\n{{end}}' \ - .github/workflows/* + - run: just-dev lint-actions devcontainer-versions: runs-on: ubuntu-latest - container: ghcr.io/linkerd/dev:v32-tools steps: + - uses: linkerd/dev/actions/setup-tools@v39 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - name: Scan workflows for other Devcontainer image versions - shell: bash - run: | - set -euo pipefail - image=$(j5j .devcontainer/devcontainer.json |jq -r '.image') - for f in .github/workflows/* ; do - for i in $(yq '.jobs.* | .container.image // .container // "" | match("ghcr.io/linkerd/dev:v[0-9]+").string' < "$f") ; do - if [ "$i" != "$image" ]; then - echo "::error file=$f::Workflow '$f' uses incorrect Devcontainer image '$i'" - exit 1 - fi - done - done + - run: just-dev check-action-images diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f2f4175bd..06d7a3c58 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: go: timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-go + container: docker://ghcr.io/linkerd/dev:v39-go steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just go-mod-check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc6b15681..da6db8186 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,7 @@ jobs: test: timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just rs-fetch @@ -55,7 +55,7 @@ jobs: contents: write timeout-minutes: 5 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - if: needs.meta.outputs.publish uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c @@ -79,7 +79,7 @@ jobs: needs: [meta, release] timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - if: '!needs.meta.outputs.publish' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 88bc365ec..440d8cc37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,7 +22,7 @@ jobs: gen-check: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just rs-fetch @@ -31,7 +31,7 @@ jobs: rust-clippy: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just rs-fetch @@ -40,7 +40,7 @@ jobs: rust-docs: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just rs-fetch @@ -49,7 +49,7 @@ jobs: rust-test: timeout-minutes: 10 runs-on: ubuntu-latest - container: docker://ghcr.io/linkerd/dev:v32-rust + container: docker://ghcr.io/linkerd/dev:v39-rust steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - run: just rs-fetch diff --git a/go.mod b/go.mod index dcd3fb73b..5032ea5fa 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/linkerd/linkerd2-proxy-api -go 1.17 +go 1.19 require ( github.com/golang/protobuf v1.5.2 diff --git a/go/destination/destination.pb.go b/go/destination/destination.pb.go index 760196cc0..962ff1f49 100644 --- a/go/destination/destination.pb.go +++ b/go/destination/destination.pb.go @@ -98,6 +98,7 @@ type Update struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Update: + // // *Update_Add // *Update_Remove // *Update_NoEndpoints @@ -390,6 +391,7 @@ type TlsIdentity struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Strategy: + // // *TlsIdentity_DnsLikeIdentity_ Strategy isTlsIdentity_Strategy `protobuf_oneof:"strategy"` } @@ -552,6 +554,7 @@ type ProtocolHint struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Protocol: + // // *ProtocolHint_H2_ // *ProtocolHint_Opaque_ Protocol isProtocolHint_Protocol `protobuf_oneof:"protocol"` @@ -986,6 +989,7 @@ type RequestMatch struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *RequestMatch_All // *RequestMatch_Any // *RequestMatch_Not @@ -1156,6 +1160,7 @@ type ResponseMatch struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *ResponseMatch_All // *ResponseMatch_Any // *ResponseMatch_Not @@ -1385,7 +1390,8 @@ type TlsIdentity_DnsLikeIdentity struct { // A DNS-like name that encodes workload coordinates. // // For example: - // {name}.{namespace}.{type}.identity.{control-namespace}.{trust-domain...} + // + // {name}.{namespace}.{type}.identity.{control-namespace}.{trust-domain...} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } diff --git a/go/http_route/http_route.pb.go b/go/http_route/http_route.pb.go index 2d06c8906..55c22ac8a 100644 --- a/go/http_route/http_route.pb.go +++ b/go/http_route/http_route.pb.go @@ -28,6 +28,7 @@ type HostMatch struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *HostMatch_Exact // *HostMatch_Suffix_ Match isHostMatch_Match `protobuf_oneof:"match"` @@ -191,6 +192,7 @@ type PathMatch struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *PathMatch_Exact // *PathMatch_Prefix // *PathMatch_Regex @@ -287,6 +289,7 @@ type HeaderMatch struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to Value: + // // *HeaderMatch_Exact // *HeaderMatch_Regex Value isHeaderMatch_Value `protobuf_oneof:"value"` @@ -376,6 +379,7 @@ type QueryParamMatch struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to Value: + // // *QueryParamMatch_Exact // *QueryParamMatch_Regex Value isQueryParamMatch_Value `protobuf_oneof:"value"` @@ -627,6 +631,7 @@ type PathModifier struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Replace: + // // *PathModifier_Full // *PathModifier_Prefix Replace isPathModifier_Replace `protobuf_oneof:"replace"` diff --git a/go/http_types/http_types.pb.go b/go/http_types/http_types.pb.go index 7280bbd0e..ef30d8813 100644 --- a/go/http_types/http_types.pb.go +++ b/go/http_types/http_types.pb.go @@ -139,6 +139,7 @@ type HttpMethod struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Type: + // // *HttpMethod_Registered_ // *HttpMethod_Unregistered Type isHttpMethod_Type `protobuf_oneof:"type"` @@ -219,6 +220,7 @@ type Scheme struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Type: + // // *Scheme_Registered_ // *Scheme_Unregistered Type isScheme_Type `protobuf_oneof:"type"` diff --git a/go/inbound/inbound.pb.go b/go/inbound/inbound.pb.go index c70aa549f..40c527fba 100644 --- a/go/inbound/inbound.pb.go +++ b/go/inbound/inbound.pb.go @@ -170,6 +170,7 @@ type ProxyProtocol struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *ProxyProtocol_Detect_ // *ProxyProtocol_Opaque_ // *ProxyProtocol_Tls_ @@ -309,7 +310,7 @@ type Authz struct { // // Must have at least one network, otherwise the authorization must be // ignored. An authorization matches all clients by including an explicit - // match on, i.e., `[0.0.0.0/0, 0::/0]``. + // match on, i.e., `[0.0.0.0/0, 0::/0]“. Networks []*Network `protobuf:"bytes,1,rep,name=networks,proto3" json:"networks,omitempty"` // Must be set. Authentication *Authn `protobuf:"bytes,2,opt,name=authentication,proto3" json:"authentication,omitempty"` @@ -449,6 +450,7 @@ type Authn struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Permit: + // // *Authn_Unauthenticated // *Authn_MeshTLS Permit isAuthn_Permit `protobuf_oneof:"permit"` @@ -1094,6 +1096,7 @@ type Authn_PermitMeshTLS struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Clients: + // // *Authn_PermitMeshTLS_Unauthenticated // *Authn_PermitMeshTLS_Identities Clients isAuthn_PermitMeshTLS_Clients `protobuf_oneof:"clients"` @@ -1291,6 +1294,7 @@ type HttpRoute_Filter struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *HttpRoute_Filter_FailureInjector // *HttpRoute_Filter_RequestHeaderModifier // *HttpRoute_Filter_Redirect @@ -1440,6 +1444,7 @@ type GrpcRoute_Filter struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *GrpcRoute_Filter_FailureInjector // *GrpcRoute_Filter_RequestHeaderModifier Kind isGrpcRoute_Filter_Kind `protobuf_oneof:"kind"` diff --git a/go/inbound/inbound_grpc.pb.go b/go/inbound/inbound_grpc.pb.go index d62404273..4ca39852f 100644 --- a/go/inbound/inbound_grpc.pb.go +++ b/go/inbound/inbound_grpc.pb.go @@ -27,9 +27,9 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type InboundServerPoliciesClient interface { - /// Gets the inbound server policy for a given workload port. + // / Gets the inbound server policy for a given workload port. GetPort(ctx context.Context, in *PortSpec, opts ...grpc.CallOption) (*Server, error) - /// Watches the inbound server policy for a given workload port. + // / Watches the inbound server policy for a given workload port. WatchPort(ctx context.Context, in *PortSpec, opts ...grpc.CallOption) (InboundServerPolicies_WatchPortClient, error) } @@ -86,9 +86,9 @@ func (x *inboundServerPoliciesWatchPortClient) Recv() (*Server, error) { // All implementations must embed UnimplementedInboundServerPoliciesServer // for forward compatibility type InboundServerPoliciesServer interface { - /// Gets the inbound server policy for a given workload port. + // / Gets the inbound server policy for a given workload port. GetPort(context.Context, *PortSpec) (*Server, error) - /// Watches the inbound server policy for a given workload port. + // / Watches the inbound server policy for a given workload port. WatchPort(*PortSpec, InboundServerPolicies_WatchPortServer) error mustEmbedUnimplementedInboundServerPoliciesServer() } diff --git a/go/meta/meta.pb.go b/go/meta/meta.pb.go index 95423dd81..6e9b3141f 100644 --- a/go/meta/meta.pb.go +++ b/go/meta/meta.pb.go @@ -28,6 +28,7 @@ type Metadata struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *Metadata_Default // *Metadata_Resource Kind isMetadata_Kind `protobuf_oneof:"kind"` diff --git a/go/net/net.pb.go b/go/net/net.pb.go index 33ff44444..04a717769 100644 --- a/go/net/net.pb.go +++ b/go/net/net.pb.go @@ -26,6 +26,7 @@ type IPAddress struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Ip: + // // *IPAddress_Ipv4 // *IPAddress_Ipv6 Ip isIPAddress_Ip `protobuf_oneof:"ip"` diff --git a/go/outbound/outbound.pb.go b/go/outbound/outbound.pb.go index 2c4d647b4..474db1ec2 100644 --- a/go/outbound/outbound.pb.go +++ b/go/outbound/outbound.pb.go @@ -37,6 +37,7 @@ type TrafficSpec struct { // Describes a target address, as observed by the proxy. // // Types that are assignable to Target: + // // *TrafficSpec_Addr // *TrafficSpec_Authority Target isTrafficSpec_Target `protobuf_oneof:"target"` @@ -177,6 +178,7 @@ type ProxyProtocol struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *ProxyProtocol_Detect_ // *ProxyProtocol_Opaque_ // *ProxyProtocol_Http1_ @@ -492,6 +494,7 @@ type Backend struct { Metadata *meta.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // Types that are assignable to Kind: + // // *Backend_Forward // *Backend_Balancer Kind isBackend_Kind `protobuf_oneof:"kind"` @@ -974,6 +977,7 @@ type HttpRoute_Filter struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *HttpRoute_Filter_FailureInjector // *HttpRoute_Filter_RequestHeaderModifier // *HttpRoute_Filter_Redirect @@ -1068,6 +1072,7 @@ type HttpRoute_Distribution struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *HttpRoute_Distribution_Empty_ // *HttpRoute_Distribution_FirstAvailable_ // *HttpRoute_Distribution_RandomAvailable_ @@ -1468,6 +1473,7 @@ type GrpcRoute_Filter struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *GrpcRoute_Filter_FailureInjector // *GrpcRoute_Filter_RequestHeaderModifier Kind isGrpcRoute_Filter_Kind `protobuf_oneof:"kind"` @@ -1548,6 +1554,7 @@ type GrpcRoute_Distribution struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *GrpcRoute_Distribution_Empty_ // *GrpcRoute_Distribution_FirstAvailable_ // *GrpcRoute_Distribution_RandomAvailable_ @@ -1932,6 +1939,7 @@ type OpaqueRoute_Distribution struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *OpaqueRoute_Distribution_Empty_ // *OpaqueRoute_Distribution_FirstAvailable_ // *OpaqueRoute_Distribution_RandomAvailable_ @@ -2262,6 +2270,7 @@ type Backend_EndpointDiscovery struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Kind: + // // *Backend_EndpointDiscovery_Dst Kind isBackend_EndpointDiscovery_Kind `protobuf_oneof:"kind"` } @@ -2334,6 +2343,7 @@ type Backend_BalanceP2C struct { // The load estimation strategy used by this load balancer. // // Types that are assignable to Load: + // // *Backend_BalanceP2C_PeakEwma_ Load isBackend_BalanceP2C_Load `protobuf_oneof:"load"` } diff --git a/go/tap/tap.pb.go b/go/tap/tap.pb.go index 7679e5552..7193abcbb 100644 --- a/go/tap/tap.pb.go +++ b/go/tap/tap.pb.go @@ -145,6 +145,7 @@ type Eos struct { unknownFields protoimpl.UnknownFields // Types that are assignable to End: + // // *Eos_GrpcStatusCode // *Eos_ResetErrorCode End isEos_End `protobuf_oneof:"end"` @@ -231,6 +232,7 @@ type TapEvent struct { DestinationMeta *TapEvent_EndpointMeta `protobuf:"bytes,4,opt,name=destination_meta,json=destinationMeta,proto3" json:"destination_meta,omitempty"` ProxyDirection TapEvent_ProxyDirection `protobuf:"varint,6,opt,name=proxy_direction,json=proxyDirection,proto3,enum=io.linkerd.proxy.tap.TapEvent_ProxyDirection" json:"proxy_direction,omitempty"` // Types that are assignable to Event: + // // *TapEvent_Http_ Event isTapEvent_Event `protobuf_oneof:"event"` } @@ -339,6 +341,7 @@ type ObserveRequest_Match struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *ObserveRequest_Match_All // *ObserveRequest_Match_Any // *ObserveRequest_Match_Not @@ -503,6 +506,7 @@ type ObserveRequest_Extract struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Extract: + // // *ObserveRequest_Extract_Http_ Extract isObserveRequest_Extract_Extract `protobuf_oneof:"extract"` } @@ -671,6 +675,7 @@ type ObserveRequest_Match_Tcp struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *ObserveRequest_Match_Tcp_Netmask_ // *ObserveRequest_Match_Tcp_Ports Match isObserveRequest_Match_Tcp_Match `protobuf_oneof:"match"` @@ -751,6 +756,7 @@ type ObserveRequest_Match_Http struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *ObserveRequest_Match_Http_Scheme // *ObserveRequest_Match_Http_Method // *ObserveRequest_Match_Http_Authority @@ -973,6 +979,7 @@ type ObserveRequest_Match_Http_StringMatch struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Match: + // // *ObserveRequest_Match_Http_StringMatch_Exact // *ObserveRequest_Match_Http_StringMatch_Prefix Match isObserveRequest_Match_Http_StringMatch_Match `protobuf_oneof:"match"` @@ -1054,6 +1061,7 @@ type ObserveRequest_Extract_Http struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Extract: + // // *ObserveRequest_Extract_Http_Headers_ Extract isObserveRequest_Extract_Http_Extract `protobuf_oneof:"extract"` } @@ -1252,6 +1260,7 @@ type TapEvent_Http struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Event: + // // *TapEvent_Http_RequestInit_ // *TapEvent_Http_ResponseInit_ // *TapEvent_Http_ResponseEnd_ diff --git a/justfile b/justfile index c905d479c..6dedc89e1 100644 --- a/justfile +++ b/justfile @@ -30,49 +30,39 @@ export PROTOC_NO_VENDOR := "1" export RUST_BACKTRACE := env_var_or_default("RUST_BACKTRACE", "short") -cargo_toolchain := "" -cargo := "cargo" + if cargo_toolchain != "" { " +" + cargo_toolchain } else { "" } +cargo-toolchain := "" +_cargo := 'just-cargo' + if cargo-toolchain != '' { ' toolchain=' + cargo-toolchain } else { '' } features := "all" _features := if features == "all" { "--all-features" } else { "--features=" + features } -# If we're running in Github Actions and cargo-action-fmt is installed, then add -# a command suffix that formats errors. -_fmt_cargo := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" } else { - ``` - if command -v cargo-action-fmt >/dev/null 2>&1; then - echo "--message-format=json | cargo-action-fmt" - fi - ``` -} - # Fetch Rust dependencies rs-fetch: - {{ cargo }} fetch --locked + {{ _cargo }} fetch --locked # Check Rust code formatting rs-check-fmt: - {{ cargo }} fmt -- --check + {{ _cargo }} fmt -- --check # Check Rust code compilation rs-check *flags: - {{ cargo }} check --frozen --all-targets {{ _features }} {{ flags }} {{ _fmt_cargo }} + {{ _cargo }} check --all-targets {{ _features }} {{ flags }} # Lint Rust code rs-clippy *flags: - {{ cargo }} clippy --frozen --all-targets {{ _features }} {{ flags }} {{ _fmt_cargo }} + {{ _cargo }} clippy --all-targets {{ _features }} {{ flags }} # Audit Rust dependencies with `cargo-deny` rs-deny *args: - {{ cargo }} deny {{ _features }} check {{ args}} + cargo-deny {{ _features }} check {{ args}} # Generate Rust documentation for this crate. rs-docs: - {{ cargo }} doc --frozen --no-deps {{ _features }} {{ _fmt_cargo }} + {{ _cargo }} doc --no-deps {{ _features }} # Generate Rust bindings from protobuf. rs-gen: - {{ cargo }} run --frozen --example=gen + cargo run --example=gen # Regenerate Rust bindings and error if they don't match what is already in # version control. @@ -86,15 +76,15 @@ rs-gen-check: rs-gen # Build Rust tests. rs-test-build *flags: - {{ cargo }} test --no-run --frozen {{ _features }} {{ flags }} {{ _fmt_cargo }} + {{ _cargo }} test-build {{ _features }} {{ flags }} # Run Rust tests. rs-test *flags: - {{ cargo }} test --frozen {{ _features }} {{ flags }} + {{ _cargo }} test {{ _features }} {{ flags }} # Public the Rust crate to crates.io. rs-publish *flags: - {{ cargo }} publish {{ _features }} {{ flags }} + cargo publish {{ _features }} {{ flags }} ## ## Go recipes @@ -156,111 +146,4 @@ go-gen-check: go-gen exit 1 fi -# Print all (transitive) dependencies of the specified go package. -go-mod-tree root='github.com/linkerd/linkerd2-proxy-api': - #!/usr/bin/env bash - set -eu - declare -r GRAPH=$(go mod graph) - deps_of() { - local pkg=$1 - echo "$GRAPH" | awk '$1 == "'"$pkg"'" { print $2 }' | sort | uniq - } - declare -A PKGS=() - subtree() { - local pkg=$1 - local namepfx=${2:-} - local pfx=${3:-} - # If the package has already been printed, then print it with an - # asterisk and skip printing its dependencies - if (( ${PKGS[$pkg]:-0} )); then - echo "$namepfx$pkg (*)" - else - # Otherwise, print the package, mark it as printed, and the - # dependency tree for each of its depndencies - echo "$namepfx$pkg" - PKGS[$pkg]=1 - local dep='' - for d in $(deps_of "$pkg") ; do - if [ -n "$dep" ]; then subtree "$dep" "$pfx├── " "$pfx│ " ; fi - dep=$d - done - if [ -n "$dep" ]; then subtree "$dep" "$pfx└── " "$pfx " ; fi - fi - } - if [[ '{{ root }}' == *@* ]]; then - # The root specifies an exact version, so print its dependencies. - subtree '{{ root }}' - elif [ -n "$(echo "$GRAPH" | awk '$1 == "{{ root }}" { print $0 }' | head -n 1)" ]; then - # The root does not specify an exact version, but that is how the - # package is listed in go.mod. - subtree '{{ root }}' - else - # The root does not specify an exact version, find all versions of the - # package and print their depdencies. - first=1 - for pkg in $(echo "$GRAPH" | awk '{ print $1 }' | sort | uniq) ; do - if [[ "$pkg" == '{{ root }}'@* ]]; then - if (( $first )); then first=0; else echo; fi - subtree "$pkg" - fi - done - fi - -# Print all (transitive) dependenents of the specified go package. -go-mod-why dep: - #!/usr/bin/env bash - set -eu - declare -r GRAPH=$(go mod graph) - depends_on() { - local pkg=$1 - echo "$GRAPH" | awk '$2 == "'"$pkg"'" { print $1 }' | sort | uniq - } - declare -A PKGS=() - supertree() { - local pkg=$1 - local namepfx=${2:-} - local pfx=${3:-} - if (( ${PKGS[$pkg]:-0} )); then - echo "$namepfx$pkg (*)" - else - PKGS[$pkg]=1 - echo "$namepfx$pkg" - local parent='' - for p in $(depends_on "$pkg") ; do - if [ -n "$parent" ]; then supertree "$parent" "$pfx├── " "$pfx│ " ; fi - parent=$p - done - if [ -n "$parent" ]; then supertree "$parent" "$pfx└── " "$pfx " ; fi - fi - } - if [[ '{{ dep }}' == *@* ]]; then - # The dependency specifies an exact version, so print the packages that - # depend on it. - supertree '{{ dep }}' - else - # The dependency does not specify an exact version, find all versions of - # the package and print the packages that depend on each of them. - first=1 - for pkg in $(echo "$GRAPH" | awk '{ print $1 }' | sort | uniq) ; do - if [[ "$pkg" == '{{ dep }}'@* ]]; then - if (( $first )); then first=0; else echo; fi - supertree "$pkg" - fi - done - fi - -# Print all versions of the specified go package. -go-mod-versions dep: - #!/usr/bin/env bash - set -eu - if [[ '{{ dep }}' == *@* ]]; then - echo 'The dependency must not specify an exact version.' >&2 - exit 1 - fi - for pkg in $(go mod graph | awk '{ print $1; print $2 }' | sort | uniq) ; do - if [[ "$pkg" == '{{ dep }}'@* ]]; then - echo "$pkg" - fi - done - # vim: set ft=make :