()
| 189 | } |
| 190 | |
| 191 | func (oo GenerateOptions) warningForStdHTTP() string { |
| 192 | pathToGoMod, mod, err := findAndParseGoModuleForDepth(".", maximumDepthToSearchForGoMod) |
| 193 | if err != nil { |
| 194 | return fmt.Sprintf("Encountered an error while trying to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it: %v", maximumDepthToSearchForGoMod, err) |
| 195 | } |
| 196 | |
| 197 | if mod == nil { |
| 198 | return fmt.Sprintf("Failed to find a `go.mod` or a `tools.mod` in this directory, or %d levels above it, so unable to validate that you're using Go 1.22+. If you start seeing API interactions resulting in a `404 page not found`, the Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", maximumDepthToSearchForGoMod) |
| 199 | } |
| 200 | |
| 201 | if !hasMinimalMinorGoDirective(minimumGoVersionForGenerateStdHTTPServer, mod) { |
| 202 | return fmt.Sprintf("Found a `go.mod` or a `tools.mod` at path %v, but it only had a version of %v, whereas the minimum required is 1.%d. It's very likely API interactions will result in a `404 page not found`. The Go directive (implying source compatibility for this module) needs to be bumped. See also: https://www.jvt.me/posts/2024/03/04/go-net-http-why-404/", pathToGoMod, mod.Go.Version, minimumGoVersionForGenerateStdHTTPServer) |
| 203 | } |
| 204 | |
| 205 | return "" |
| 206 | } |
| 207 | |
| 208 | // CompatibilityOptions specifies backward compatibility settings for the |
| 209 | // code generator. |
no test coverage detected