@@ -603,7 +603,7 @@ func TestGitGetter_sshSCPStyleInvalidScheme(t *testing.T) {
603603
604604got := err .Error ()
605605want1 , want2 := `invalid source string` , `invalid port number "hashicorp"`
606- if ! ( strings .Contains (got , want1 ) || strings .Contains (got , want2 ) ) {
606+ if ! strings .Contains (got , want1 ) && ! strings .Contains (got , want2 ) {
607607t .Fatalf ("wrong error\n got: %s\n want: %q or %q" , got , want1 , want2 )
608608}
609609}
@@ -621,7 +621,7 @@ func TestGitGetter_submodule(t *testing.T) {
621621if err != nil {
622622t .Fatal (err )
623623}
624- return strings .Replace (relpath , `\` , `/` , - 1 )
624+ return strings .ReplaceAll (relpath , `\` , `/` )
625625// on windows git still prefers relatives paths
626626// containing `/` for submodules
627627}
@@ -887,7 +887,7 @@ func TestGitGetter_BadGitConfig(t *testing.T) {
887887
888888_ , err = os .Stat (dst )
889889if err != nil && ! os .IsNotExist (err ) {
890- t .Fatalf (err .Error ())
890+ t .Fatal (err .Error ())
891891}
892892if err == nil {
893893// Update the repository containing the bad git config.
@@ -897,29 +897,29 @@ func TestGitGetter_BadGitConfig(t *testing.T) {
897897// Clone a repository with a git config file
898898err = g .clone (ctx , dst , testGitToken , url , "main" , 1 )
899899if err != nil {
900- t .Fatalf (err .Error ())
900+ t .Fatal (err .Error ())
901901}
902902
903903// Edit the git config file to simulate a bad git config
904904gitConfigPath := filepath .Join (dst , ".git" , "config" )
905905err = os .WriteFile (gitConfigPath , []byte ("bad config" ), 0600 )
906906if err != nil {
907- t .Fatalf (err .Error ())
907+ t .Fatal (err .Error ())
908908}
909909
910910// Update the repository containing the bad git config.
911911// This should remove the bad git config file and initialize a new one.
912912err = g .update (ctx , dst , testGitToken , url , "main" , 1 )
913913}
914914if err != nil {
915- t .Fatalf (err .Error ())
915+ t .Fatal (err .Error ())
916916}
917917
918918// Check if the .git/config file contains "bad config"
919919gitConfigPath := filepath .Join (dst , ".git" , "config" )
920920configBytes , err := os .ReadFile (gitConfigPath )
921921if err != nil {
922- t .Fatalf (err .Error ())
922+ t .Fatal (err .Error ())
923923}
924924if strings .Contains (string (configBytes ), "bad config" ) {
925925t .Fatalf ("The .git/config file contains 'bad config'" )
@@ -943,37 +943,37 @@ func TestGitGetter_BadGitDirName(t *testing.T) {
943943
944944_ , err = os .Stat (dst )
945945if err != nil && ! os .IsNotExist (err ) {
946- t .Fatalf (err .Error ())
946+ t .Fatal (err .Error ())
947947}
948948if err == nil {
949949// Remove all variations of .git directories
950950err = removeCaseInsensitiveGitDirectory (dst )
951951if err != nil {
952- t .Fatalf (err .Error ())
952+ t .Fatal (err .Error ())
953953}
954954} else {
955955// Clone a repository with a git directory
956956err = g .clone (ctx , dst , testGitToken , url , "main" , 1 )
957957if err != nil {
958- t .Fatalf (err .Error ())
958+ t .Fatal (err .Error ())
959959}
960960
961961// Rename the .git directory to .GIT
962962oldPath := filepath .Join (dst , ".git" )
963963newPath := filepath .Join (dst , ".GIT" )
964964err = os .Rename (oldPath , newPath )
965965if err != nil {
966- t .Fatalf (err .Error ())
966+ t .Fatal (err .Error ())
967967}
968968
969969// Remove all variations of .git directories
970970err = removeCaseInsensitiveGitDirectory (dst )
971971if err != nil {
972- t .Fatalf (err .Error ())
972+ t .Fatal (err .Error ())
973973}
974974}
975975if err != nil {
976- t .Fatalf (err .Error ())
976+ t .Fatal (err .Error ())
977977}
978978
979979// Check if the .GIT directory exists
@@ -1004,13 +1004,13 @@ func TestGitGetter_BadRef(t *testing.T) {
10041004
10051005_ , err = os .Stat (dst )
10061006if err != nil && ! os .IsNotExist (err ) {
1007- t .Fatalf (err .Error ())
1007+ t .Fatal (err .Error ())
10081008}
10091009
10101010// Clone a repository with non-existent ref
10111011err = g .clone (ctx , dst , "" , url , "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" , 0 )
10121012if err == nil {
1013- t .Fatalf (err .Error ())
1013+ t .Fatal (err .Error ())
10141014}
10151015
10161016// Expect that the dst was cleaned up after failed ref checkout
0 commit comments