-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup usage of go.rice in favor of go:embed (#10956)
* Cleanup usage of go.rice in favor of go:embed The usage of go.rice predates the availability of go:embed, but we should switch to using go:embed instead to ship specific assets like config files that we need. go.rice is also incompatible with Go 1.19 and while it might see a fix in the future, it seems better to go with the recommended Go approach that is available these days. Signed-off-by: Dirkjan Bussink <[email protected]> * Move vtctld to also use `go embed` instead of go.rice Signed-off-by: Dirkjan Bussink <[email protected]> * Remove last rice-box related comments Signed-off-by: Dirkjan Bussink <[email protected]> * Remove config moving This right now breaks building the actual tests since the tests might also end up loading the regular code which has a `go embed` and refers to the package with the config embeds. This doesn't mean that the config isn't properly included in the binaries. Also with using `go embed` we have a build time dependency on the files and we always know the latest is included, so we don't have the issue of potentially outdated files either. All in all, it seems simplest to remove this logic and trust that Go itself works as advertised. Signed-off-by: Dirkjan Bussink <[email protected]>
- Loading branch information
Showing
20 changed files
with
101 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,4 @@ jobs: | |
if [ ${{matrix.os}} = "macos-latest" ]; then | ||
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | ||
fi | ||
# Make sure that testing is entirely non-reliant on config | ||
mv config config-moved | ||
eatmydata -- go run test.go -print-log -follow -retry=1 local_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,5 @@ jobs: | |
if [ ${{matrix.os}} = "macos-latest" ]; then | ||
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | ||
fi | ||
# Make sure that testing is entirely non-reliant on config | ||
mv config config-moved | ||
sed -i 's/user\/my-vitess/runner\/work\/vitess\/vitess/g' examples/region_sharding/main_vschema_sharded.json #set correct path to countries.json | ||
eatmydata -- go run test.go -print-log -follow -retry=1 region_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package config | ||
|
||
import _ "embed" | ||
|
||
//go:embed init_db.sql | ||
var DefaultInitDB string | ||
|
||
//go:embed mycnf/default.cnf | ||
var MycnfDefault string | ||
|
||
//go:embed mycnf/mariadb100.cnf | ||
var MycnfMariaDB100 string | ||
|
||
//go:embed mycnf/mariadb101.cnf | ||
var MycnfMariaDB101 string | ||
|
||
//go:embed mycnf/mariadb102.cnf | ||
var MycnfMariaDB102 string | ||
|
||
//go:embed mycnf/mariadb103.cnf | ||
var MycnfMariaDB103 string | ||
|
||
//go:embed mycnf/mariadb104.cnf | ||
var MycnfMariaDB104 string | ||
|
||
//go:embed mycnf/mysql57.cnf | ||
var MycnfMySQL57 string | ||
|
||
//go:embed mycnf/mysql80.cnf | ||
var MycnfMySQL80 string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.