From 2bd8e44f499000cd1727349f6e035e6e0ba60e83 Mon Sep 17 00:00:00 2001 From: songhang Date: Thu, 1 Aug 2024 11:14:30 -0600 Subject: [PATCH] add doc, optimize go generate --- analyze.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/analyze.go b/analyze.go index 0a87c47c..d29d06af 100644 --- a/analyze.go +++ b/analyze.go @@ -7,6 +7,8 @@ package crossplane +// Upgrade for .gen.go files. If you don't have access to some private modules, please use -skip options to skip them. e.g. go generate -skip="nap". + // Update for headersmore //go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/openresty/headers-more-nginx-module.git --config-path ./scripts/generate/configs/headersmore_config.json > ./analyze_headersMore_directives.gen.go" @@ -27,14 +29,13 @@ package crossplane //go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/nginxinc/nginx-otel.git --config-path ./scripts/generate/configs/otel_config.json --branch main > ./analyze_otel_directives.gen.go" // Update for NAP v4 and v5. -// NAP is a private module. Please ensure you have correct access and put the url +// NAP is a private module. Please ensure you have correct access and put the url. // and branch of it in environment variable NAP_URL, NAP_V4_BRANCH, and NAP_V5_BRANCH. -// Most of users don't have access, so we only run generate.sh when corresponding environment variables are set. // Override is for flag dirctives. NAP used ngxConfTake1 for flag directives, we change them to ngxConfFlag in crossplane. // NAP v4 -//go:generate sh -c "if [ -z $NAP_V4_BRANCH ] || [ -z $NAP_URL ] ; then echo NAP v4 information missing, please set the environment variable NAP_URL, NAP_V4_BRANCH and ensure you have correct access && exit 1; else sh ./scripts/generate/generate.sh --url $NAP_URL --config-path ./scripts/generate/configs/nap_v4_config.json --branch $NAP_V4_BRANCH --path ./src > analyze_appProtectWAFv4_directives.gen.go; fi" +//go:generate sh -c "sh ./scripts/generate/generate.sh --url $NAP_URL --config-path ./scripts/generate/configs/nap_v4_config.json --branch $NAP_V4_BRANCH --path ./src > analyze_appProtectWAFv4_directives.gen.go" // NAP v5 -//go:generate sh -c "if [ -z $NAP_V5_BRANCH ] || [ -z $NAP_URL ] ; then echo NAP v5 information missing, please set the environment variable NAP_URL, NAP_V5_BRANCH and ensure you have correct access && exit 1; else sh ./scripts/generate/generate.sh --url $NAP_URL --config-path ./scripts/generate/configs/nap_v5_config.json --branch $NAP_V5_BRANCH --path ./src > analyze_appProtectWAFv5_directives.gen.go; fi" +//go:generate sh -c "sh ./scripts/generate/generate.sh --url $NAP_URL --config-path ./scripts/generate/configs/nap_v5_config.json --branch $NAP_V5_BRANCH --path ./src > analyze_appProtectWAFv5_directives.gen.go" import ( "fmt"