Skip to content

Commit bb4f6db

Browse files
committed
go generate for public modules/OSS
1 parent 86bf818 commit bb4f6db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+6621
-6211
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ run:
4343
modules-download-mode: mod
4444
skip-dirs-use-default: true
4545

46+
4647
# Specific linter settings
4748
linters-settings:
4849
gocyclo:
@@ -62,6 +63,9 @@ linters-settings:
6263
local-prefixes: gitswarm.f5net.com/indigo,gitlab.com/f5
6364
errcheck:
6465
ignore: ^Close.*,os:^Setenv.*,fmt:.*,io/ioutil:^Read.*,github.com/spf13/viper:.*,github.com/pkg/errors:^Wrap.*
66+
funclen:
67+
skip-ifles:
68+
- ".*\\.gen\\.go"
6569

6670
lll:
6771
line-length: 140

analyze.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@
77

88
package crossplane
99

10+
// Update for headersmore
11+
//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"
12+
13+
// Update for njs
14+
//go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/nginx/njs.git --config-path ./scripts/generate/configs/njs_config.json > ./analyze_njs_directives.gen.go"
15+
16+
// Update for OSS, filter in config is the directives not in https://nginx.org/en/docs/dirindex.html but in source code.
17+
// Override in config is for the "if" directive. We create a bitmask ngxConfExpr for it in crossplane, which is not in source code.
18+
//go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/nginx/nginx.git --config-path ./scripts/generate/configs/oss_latest_config.json > ./analyze_oss_latest_directives.gen.go"
19+
//go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/nginx/nginx.git --config-path ./scripts/generate/configs/oss_126_config.json --branch branches/stable-1.26 > ./analyze_oss_126_directives.gen.go"
20+
//go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/nginx/nginx.git --config-path ./scripts/generate/configs/oss_124_config.json --branch branches/stable-1.24 > ./analyze_oss_124_directives.gen.go"
21+
22+
// Update for lua, override is for the lua block directives, see https://github.com/nginxinc/nginx-go-crossplane/pull/86.
23+
//go:generate sh -c "sh ./scripts/generate/generate.sh --url https://github.com/openresty/lua-nginx-module.git --config-path ./scripts/generate/configs/lua_config.json --path ./src > ./analyze_lua_directives.gen.go"
24+
25+
// Update for otel. Filter is for some directives withou context.
26+
// Otel provides its own config handler for some directives and they don't have context. Currently we don't support them.
27+
//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"
28+
1029
import (
1130
"fmt"
1231
)
@@ -219,7 +238,7 @@ func unionBitmaskMaps(maps ...map[string][]uint) map[string][]uint {
219238
// not provided. It is union of latest Nplus, Njs, and Otel.
220239
//
221240
//nolint:gochecknoglobals
222-
var defaultDirectives = unionBitmaskMaps(ngxPlusLatestDirectives, moduleNjsDirectives, moduleOtelDirectives)
241+
var defaultDirectives = unionBitmaskMaps(nginxPlusLatestDirectives, njsDirectives, otelDirectives)
223242

224243
func DefaultDirectivesMatchFunc(directive string) ([]uint, bool) {
225244
masks, matched := defaultDirectives[directive]

analyze_appProtectWAFv4_directives.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ var appProtectWAFv4Directives = map[string][]uint{
4343
},
4444
}
4545

46-
// AppProtectWAFv4DirectivesMatchFn is a match function for parsing an NGINX config that contains the
46+
// MatchAppProtectWAFv4 is a match function for parsing an NGINX config that contains the
4747
// App Protect v4 module.
48-
func AppProtectWAFv4DirectivesMatchFn(directive string) ([]uint, bool) {
48+
func MatchAppProtectWAFv4(directive string) ([]uint, bool) {
4949
masks, matched := appProtectWAFv4Directives[directive]
5050
return masks, matched
5151
}

analyze_appProtectWAFv5_directives.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ var appProtectWAFv5Directives = map[string][]uint{
4343
},
4444
}
4545

46-
// AppProtectWAFv5DirectivesMatchFn is a match function for parsing an NGINX config that contains the
46+
// MatchAppProtectWAFv5 is a match function for parsing an NGINX config that contains the
4747
// App Protect v5 module.
48-
func AppProtectWAFv5DirectivesMatchFn(directive string) ([]uint, bool) {
48+
func MatchAppProtectWAFv5(directive string) ([]uint, bool) {
4949
masks, matched := appProtectWAFv5Directives[directive]
5050
return masks, matched
5151
}

analyze_headersMore_directives.gen.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analyze_headersMore_directives.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)