Skip to content

Commit 7075609

Browse files
authored
Small fixes (knative#3310)
1 parent d12841d commit 7075609

File tree

13 files changed

+30
-31
lines changed

13 files changed

+30
-31
lines changed

cmd/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,8 @@ func (c buildConfig) Validate(cmd *cobra.Command) (err error) {
468468
// for S2I.
469469
//
470470
// TODO: As a further optimization, it might be ideal to only build the
471-
// image necessary for the target cluster, since the end product of a function
472-
// deployment is not the contiainer, but rather the running service.
471+
// image necessary for the target cluster, since the end product of a function
472+
// deployment is not the container, but rather the running service.
473473
func (c buildConfig) clientOptions() ([]fn.Option, error) {
474474
o := []fn.Option{fn.WithRegistry(c.Registry)}
475475

cmd/deploy_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ func TestDeploy_NamespaceUpdateWarning(t *testing.T) {
12271227

12281228
activeNamespace, err := k8s.GetDefaultNamespace()
12291229
if err != nil {
1230-
t.Fatalf("Couldnt get active namespace, got error: %v", err)
1230+
t.Fatalf("Couldn't get active namespace, got error: %v", err)
12311231
}
12321232

12331233
expected1 := "Info: chosen namespace has changed from 'myns' to 'newns'. Undeploying function from 'myns' and deploying new in 'newns'."
@@ -1248,7 +1248,7 @@ func TestDeploy_NamespaceUpdateWarning(t *testing.T) {
12481248
}
12491249
}
12501250

1251-
// TestDeploy_BasicRedeploy simply ensures that redeploy works and doesnt brake
1251+
// TestDeploy_BasicRedeploy simply ensures that redeploy works and doesn't break
12521252
// using standard deploy method when desired namespace is deleted.
12531253
func TestDeploy_BasicRedeployInCorrectNamespace(t *testing.T) {
12541254
root := FromTempDirectory(t)
@@ -1289,7 +1289,7 @@ func TestDeploy_BasicRedeployInCorrectNamespace(t *testing.T) {
12891289
}
12901290

12911291
// TestDeploy_BasicRedeployPipelines simply ensures that deploy 2 times works
1292-
// and doesnt brake using pipelines
1292+
// and doesn't break using pipelines
12931293
func TestDeploy_BasicRedeployPipelinesCorrectNamespace(t *testing.T) {
12941294
root := FromTempDirectory(t)
12951295

@@ -1816,7 +1816,7 @@ func TestReDeploy_OnRegistryChange(t *testing.T) {
18161816
// ASSERT
18171817
expectF, err := fn.NewFunction(root)
18181818
if err != nil {
1819-
t.Fatal("couldnt load function from path")
1819+
t.Fatal("couldn't load function from path")
18201820
}
18211821

18221822
if !strings.Contains(expectF.Build.Image, newRegistry) {
@@ -1865,7 +1865,7 @@ func TestReDeploy_OnRegistryChangeWithBuildFalse(t *testing.T) {
18651865

18661866
// TestDeploy_NoErrorOnOldFunctionNotFound assures that no error is given when
18671867
// old Function's service is not available (is already deleted manually or the
1868-
// namespace doesnt exist etc.)
1868+
// namespace doesn't exist etc.)
18691869
func TestDeploy_NoErrorOnOldFunctionNotFound(t *testing.T) {
18701870
var (
18711871
root = FromTempDirectory(t)
@@ -1918,7 +1918,7 @@ func TestDeploy_NoErrorOnOldFunctionNotFound(t *testing.T) {
19181918
if err = cmd.Execute(); err != nil {
19191919
// possible TODO: catch the os.Stderr output and check that this is printed out
19201920
// and if this is implemented, probably change the name to *_WarnOnFunction
1921-
// expectedWarning := fmt.Sprintf("Warning: Cant undeploy Function in namespace '%s' - service not found. Namespace/Service might be deleted already", nsOne)
1921+
// expectedWarning := fmt.Sprintf("Warning: Can't undeploy Function in namespace '%s' - service not found. Namespace/Service might be deleted already", nsOne)
19221922

19231923
// ASSERT
19241924

cmd/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Or if you have an existing function:
232232
}
233233
}
234234
} else { // if !container
235-
// dont run digested image without a container
235+
// don't run digested image without a container
236236
if cfg.Image != "" {
237237
digested, err := isDigested(cfg.Image)
238238
if err != nil {

cmd/run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func TestRun_DirectOverride(t *testing.T) {
459459
return
460460
}
461461

462-
// Ensure invocation doesnt happen for the second time as the image was
462+
// Ensure invocation doesn't happen for the second time as the image was
463463
// provided with a digest (should not build)
464464
if builder2.BuildInvoked {
465465
runErrCh <- fmt.Errorf("Function was not expected to build again but it did")

hack/cmd/components/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// This is running on semi-auto basis where versions are being auto bumped via
1111
// PRs sent to main. Semi-auto because if repo is missing 'owner' or 'repo' fields
1212
// in the .json it will not be automatically bumped (it has no repo to look).
13-
// This is intentional for components we dont want autobumped like this.
13+
// This is intentional for components we don't want autobumped like this.
1414
// The source-of-truth file is found in this repo @root/hack/component-versions.json
1515
//
1616
// ADD NEW/MODIFY COMPONENTS
@@ -74,7 +74,7 @@ type ComponentList map[string]*Component
7474
func main() {
7575
// Set up context for possible signal inputs to not disrupt cleanup process.
7676
// This is not gonna do much for workflows since they finish and shutdown
77-
// but in case of local testing - dont leave left over resources on disk/RAM.
77+
// but in case of local testing - don't leave left over resources on disk/RAM.
7878
ctx, cancel := context.WithCancel(context.Background())
7979
defer cancel()
8080
sigs := make(chan os.Signal, 1)
@@ -194,7 +194,7 @@ func writeFiles(cl ComponentList, script, json string) error {
194194
func writeSource(cl ComponentList, file string) error {
195195
vB, err := json.MarshalIndent(cl, "", " ")
196196
if err != nil {
197-
return fmt.Errorf("cant Marshal versions: %v", err)
197+
return fmt.Errorf("can't Marshal versions: %v", err)
198198
}
199199
f, err := os.Create(file)
200200
if err != nil {

hack/cmd/update-builder/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import (
4444
func main() {
4545
// Set up context for possible signal inputs to not disrupt cleanup process.
4646
// This is not gonna do much for workflows since they finish and shutdown
47-
// but in case of local testing - dont leave left over resources on disk/RAM.
47+
// but in case of local testing - don't leave left over resources on disk/RAM.
4848
ctx, cancel := context.WithCancel(context.Background())
4949
defer cancel()
5050
sigs := make(chan os.Signal, 1)
@@ -98,7 +98,7 @@ func buildBuilderImage(ctx context.Context, variant, version, arch, builderTomlP
9898
return "", fmt.Errorf("cannot patch java buildpacks: %w", err)
9999
}
100100
if arch == "arm64" && variant == "base" {
101-
// dotnet,ruby&web-servers are not multiarch & we dont need them
101+
// dotnet,ruby&web-servers are not multiarch & we don't need them
102102
err = fixupRemoveUnusedBuildpacks(&builderConfig)
103103
if err != nil {
104104
return "", fmt.Errorf("failed to remove unused buildpacks: %w", err)
@@ -659,7 +659,7 @@ func downloadTarball(tarballUrl, destDir string) error {
659659
case tar.TypeDir:
660660
err = os.MkdirAll(dest, 0755)
661661
if err != nil {
662-
return fmt.Errorf("cannmot create a directory: %w", err)
662+
return fmt.Errorf("cannot create a directory: %w", err)
663663
}
664664
case tar.TypeXGlobalHeader:
665665
// ignore this type
@@ -780,7 +780,7 @@ func fixupRemoveUnusedBuildpacks(c *builder.Config) error {
780780
return nil
781781
}
782782

783-
// Copy build & run images from stack so that we dont use docker registry based images
783+
// Copy build & run images from stack so that we don't use docker registry based images
784784
// Run images are simply copied over to ghcr
785785
func copyStackImages(ctx context.Context, configPath string) error {
786786
var err error

hack/test-full.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ preconditions() {
107107
exit 1
108108
fi
109109
MISSING_BINS=""
110-
for bin in kubectl kind jq stern dapr helm kn
110+
for bin in kubectl kind jq stern dapr helm kn; do
111111
# Check with and without .exe for Windows compatibility
112112
if [ ! -f "${PROJECT_ROOT}/hack/bin/${bin}" ] && [ ! -f "${PROJECT_ROOT}/hack/bin/${bin}.exe" ]; then
113113
MISSING_BINS="${MISSING_BINS} ${bin}"

hack/update-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ echo ">> args='$@'"
2626
# This is a guard for running only when its running via bot to update deps and
2727
# potentially create a PR.
2828
# When this is running in 'verify deps' workflow it runs with no arguments.
29-
# We dont want these changes to break the GH Action for all PRs therefore we
29+
# We don't want these changes to break the GH Action for all PRs therefore we
3030
# limit this only for dependency bumps.
3131
if [[ $# -gt 0 ]]; then
3232
echo ">> Running make hack-generate-components"

pkg/builders/builders_int_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ password=nbusr123
157157
{
158158
Name: "pack",
159159
Builder: buildpacks.NewBuilder(buildpacks.WithVerbose(true)),
160-
BuilderImage: buildPatcheBuildpackBuilder,
160+
BuilderImage: buildPatchedBuildpackBuilder,
161161
Envs: []fn.Env{
162162
{
163163
Name: ptr("SERVICE_BINDING_ROOT"),
@@ -280,7 +280,7 @@ USER 1001:0
280280
}
281281

282282
// Builds a tiny paketo builder that trusts to our self-signed certificate (see createCertificate).
283-
func buildPatcheBuildpackBuilder(ctx context.Context, t *testing.T, certDir string) string {
283+
func buildPatchedBuildpackBuilder(ctx context.Context, t *testing.T, certDir string) string {
284284
tag := "localhost:50000/builder-jammy-tin:test"
285285
dockerfile := `FROM ghcr.io/knative/builder-jammy-tiny:latest
286286
COPY 85c05568.0 /etc/ssl/certs/

pkg/creds/credentials_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,11 +768,11 @@ func TestCredentialsHomePermissions(t *testing.T) {
768768
_, err := testConfigPathError(t)
769769
if err != nil { // If error was returned
770770
if os.IsPermission(err) { // and its a permission error
771-
if !tt.expPermsDeniedErr { // but it wasnt expected
772-
t.Fatalf("didnt expect permissions denied error, but got: %s", err)
771+
if !tt.expPermsDeniedErr { // but it wasn't expected
772+
t.Fatalf("didn't expect permissions denied error, but got: %s", err)
773773
}
774774

775-
} else { // and it wasnt permission error
775+
} else { // and it wasn't permission error
776776
t.Fatalf("got unexpected error: %v", err)
777777
}
778778
} else { // Else no error was returned
@@ -1287,7 +1287,7 @@ func setHomeWithPermissions(perm os.FileMode) func(t *testing.T) {
12871287

12881288
// if home is empty, nothing to do
12891289
if homeDir == "" {
1290-
t.Fatal("home dir is empty, cant set perms")
1290+
t.Fatal("home dir is empty, can't set perms")
12911291
}
12921292

12931293
fmt.Printf("setting permissions (%v) on home dir: %s\n", perm, homeDir)

0 commit comments

Comments
 (0)