Skip to content

Commit

Permalink
add doc, optimize go generate
Browse files Browse the repository at this point in the history
  • Loading branch information
dengsh12 committed Aug 1, 2024
1 parent 7f40574 commit 2bd8e44
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand Down

0 comments on commit 2bd8e44

Please sign in to comment.