Debian Codegraph @

internal/versions/features.go

raw symbols SCIP
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package versionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/
6
7 // This file contains predicates for working with file versions to
8 // decide when a tool should consider a language feature enabled.
9
10 // named constants, to avoid misspelling
11 const (
12 Go1_17scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_17. = "go1.17"
13 Go1_18scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_18. = "go1.18"
14 Go1_19scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_19. = "go1.19"
15 Go1_20scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_20. = "go1.20"
16 Go1_21scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_21. = "go1.21"
17 Go1_22scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_22. = "go1.22"
18 Go1_23scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_23. = "go1.23"
19 Go1_24scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_24. = "go1.24"
20 Go1_25scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_25. = "go1.25"
21 Go1_26scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_26. = "go1.26"
22 Go1_27scip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Go1_27. = "go1.27"
23 )
24
25 // Future is an invalid unknown Go version sometime in the future.
26 // Do not use directly with Compare.
27 const Futurescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Future. = ""
28
29 // AtLeast reports whether the file version v comes after a Go release.
30 //
31 // Use this predicate to enable a behavior once a certain Go release
32 // has happened (and stays enabled in the future).
33 func AtLeastscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/AtLeast().(v, release string) bool {
34 if v == Futurescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Future. {
35 return true // an unknown future version is always after y.
36 }
37 return Comparescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Compare().(Langscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Lang().(v), Langscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Lang().(release)) >= 0
38 }
39
40 // Before reports whether the file version v is strictly before a Go release.
41 //
42 // Use this predicate to disable a behavior once a certain Go release
43 // has happened (and stays enabled in the future).
44 func Beforescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Before().(v, release string) bool {
45 if v == Futurescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Future. {
46 return false // an unknown future version happens after y.
47 }
48 return Comparescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Compare().(Langscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Lang().(v), Langscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/versions`/Lang().(release)) < 0
49 }