Skip to content

Repository initialization has hard assumptions #74

@BigGold1310

Description

@BigGold1310

What Happened?

I've cloned the repository and run ./init.sh my-cool-fn. The init.sh script is currently only changing the package names but not updating the Go module path. Updating the Go module path is essential for the package to function properly and to facilitate hosting on GitHub/GitLab.

Proposal

I expect the init.sh script to take the Go module path as its first argument. This will ensure that both the import paths and the Go module paths are updated correctly. To maintain compatibility with the example/* replacements, we can extract and use the last segment of the path as the package name.

  1. Clone or download the repository.
  2. Run ./init.sh github.com/my-fancy-org/my-cool-fn.
  3. Should update as following:
    1. go.mod gets updated to github.com/my-fancy-org/my-cool-fn.
    2. fn.go gets updated to github.com/my-fancy-org/my-cool-fn/input/v1beta1.
    3. Replace function-template-go with my-cool-fn

Steps to Reproduce

  1. Clone or download the repository.
  2. Run ./init.sh my-cool-fn.
  3. Verify the following:
    1. go.mod gets updated to github.com/crossplane/my-cool-fn.
    2. fn.go gets updated to github.com/crossplane/my-cool-fn/input/v1beta1.

Environment Details

  • Function version: main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions