Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor repository layout #1554

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Check that 'func.yaml schema' is up-to-date
run: make schema-check
- name: Check embedded templates content
run: go test -run "^\QTestFileSystems\E$/^\Qembedded\E$"
run: go test -run "^\QTestFileSystems\E$/^\Qembedded\E$" ./pkg/filesystem

test-unit:
runs-on: "ubuntu-latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-embedded-fs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
go-version: ${{ matrix.go }}
- name: Check embedded templates content
run: |
if ! go test -run "^\QTestFileSystems\E$/^\Qembedded\E$"; then
if ! go test -run "^\QTestFileSystems\E$/^\Qembedded\E$" ./pkg/filesystem; then
echo "Content of templates directory and embedded FS (zz_filesystem_generated.go) doesn't match!"
echo "Consult https://github.com/knative/func/blob/main/docs/CONTRIBUTING.md#templates ."
exit 1
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ clean_templates:

.PHONY: zz_filesystem_generated.go

zz_filesystem_generated.go: clean_templates
go generate filesystem.go
generate/zz_filesystem_generated.go: clean_templates
go generate pkg/functions/templates_embedded.go

.PHONY: clean

Expand Down Expand Up @@ -199,7 +199,7 @@ $(BIN_WINDOWS): zz_filesystem_generated.go
##@ Schemas
######################
schema-generate: schema/func_yaml-schema.json ## Generate func.yaml schema
schema/func_yaml-schema.json: function.go
schema/func_yaml-schema.json: pkg/functions/function.go
go run schema/generator/main.go

schema-check: ## Check that func.yaml schema is up-to-date
Expand Down
11 changes: 5 additions & 6 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

"knative.dev/func/buildpacks"
"knative.dev/func/config"
"knative.dev/func/s2i"

fn "knative.dev/func"
"knative.dev/func/builders"
"knative.dev/func/pkg/builders"
"knative.dev/func/pkg/builders/buildpacks"
"knative.dev/func/pkg/builders/s2i"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
)

func NewBuildCmd(newClient ClientFactory) *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"testing"

fn "knative.dev/func"
"knative.dev/func/builders"
"knative.dev/func/mock"
"knative.dev/func/pkg/builders"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// TestBuild_ConfigApplied ensures that the build command applies config
Expand Down
20 changes: 10 additions & 10 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"net/http"
"os"

fn "knative.dev/func"
"knative.dev/func/buildpacks"
"knative.dev/func/config"
"knative.dev/func/docker"
"knative.dev/func/docker/creds"
fnhttp "knative.dev/func/http"
"knative.dev/func/knative"
"knative.dev/func/openshift"
"knative.dev/func/pipelines/tekton"
"knative.dev/func/progress"
"knative.dev/func/pkg/builders/buildpacks"
"knative.dev/func/pkg/config"
"knative.dev/func/pkg/docker"
"knative.dev/func/pkg/docker/creds"
fn "knative.dev/func/pkg/functions"
fnhttp "knative.dev/func/pkg/http"
"knative.dev/func/pkg/knative"
"knative.dev/func/pkg/openshift"
"knative.dev/func/pkg/pipelines/tekton"
"knative.dev/func/pkg/progress"
)

// ClientConfig settings for use with NewClient
Expand Down
4 changes: 2 additions & 2 deletions cmd/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"testing"

fn "knative.dev/func"
"knative.dev/func/mock"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// Test_NewTestClient ensures that the convenience method for
Expand Down
4 changes: 2 additions & 2 deletions cmd/completion_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/knative"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/knative"
)

func CompleteFunctionList(cmd *cobra.Command, args []string, toComplete string) (strings []string, directive cobra.ShellCompDirective) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
fn "knative.dev/func/pkg/functions"
)

type functionLoader interface {
Expand Down
6 changes: 3 additions & 3 deletions cmd/config_envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/k8s"
"knative.dev/func/utils"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
"knative.dev/func/pkg/utils"
)

func NewConfigEnvsCmd(loadSaver functionLoaderSaver) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/config_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/utils"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/utils"
)

func NewConfigLabelsCmd(loaderSaver functionLoaderSaver) *cobra.Command {
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/Netflix/go-expect"
"github.com/hinshun/vt10x"
"github.com/spf13/cobra"
fn "knative.dev/func"
fn "knative.dev/func/pkg/functions"
)

type mockFunctionLoaderSaver struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"

"github.com/ory/viper"
fn "knative.dev/func"
fnCmd "knative.dev/func/cmd"
fn "knative.dev/func/pkg/functions"
)

func TestListEnvs(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/config_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/k8s"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
)

func NewConfigVolumesCmd() *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/utils"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/utils"
)

// ErrNoRuntime indicates that the language runtime flag was not passed.
Expand Down
2 changes: 1 addition & 1 deletion cmd/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"testing"

"knative.dev/func/utils"
"knative.dev/func/pkg/utils"
)

// TestCreate_Execute ensures that an invocation of create with minimal settings
Expand Down
4 changes: 2 additions & 2 deletions cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
)

func NewDeleteCmd(newClient ClientFactory) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"path/filepath"
"testing"

fn "knative.dev/func"
"knative.dev/func/mock"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// TestDelete_Namespace ensures that the namespace provided to the client
Expand Down
16 changes: 8 additions & 8 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
"github.com/spf13/cobra"
"knative.dev/client/pkg/util"

fn "knative.dev/func"
"knative.dev/func/builders"
"knative.dev/func/buildpacks"
"knative.dev/func/config"
"knative.dev/func/docker"
"knative.dev/func/docker/creds"
"knative.dev/func/k8s"
"knative.dev/func/s2i"
"knative.dev/func/pkg/builders"
"knative.dev/func/pkg/builders/buildpacks"
"knative.dev/func/pkg/builders/s2i"
"knative.dev/func/pkg/config"
"knative.dev/func/pkg/docker"
"knative.dev/func/pkg/docker/creds"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
)

func NewDeployCmd(newClient ClientFactory) *cobra.Command {
Expand Down
9 changes: 5 additions & 4 deletions cmd/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (

"github.com/ory/viper"
"github.com/spf13/cobra"
fn "knative.dev/func"
"knative.dev/func/builders"
"knative.dev/func/config"
"knative.dev/func/mock"

"knative.dev/func/pkg/builders"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// commandConstructor is used to share test implementations between commands
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
)

func NewDescribeCmd(newClient ClientFactory) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cmd
import (
"testing"

fn "knative.dev/func"
"knative.dev/func/mock"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// TestDescribe_ByName ensures that describing a function by name invokes
Expand Down
2 changes: 1 addition & 1 deletion cmd/func/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/AlecAivazis/survey/v2/terminal"
"knative.dev/func/cmd"
"knative.dev/func/docker"
"knative.dev/func/pkg/docker"
)

// Statically-populated build metadata set by `make build`.
Expand Down
6 changes: 3 additions & 3 deletions cmd/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/utils"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/utils"
)

func NewInvokeCmd(newClient ClientFactory) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/invoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sync/atomic"
"testing"

fn "knative.dev/func"
"knative.dev/func/mock"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// TestInvoke command executes the invocation path.
Expand Down
2 changes: 1 addition & 1 deletion cmd/languages.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
fn "knative.dev/func/pkg/functions"
)

func NewLanguagesCmd(newClient ClientFactory) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
)

func NewListCmd(newClient ClientFactory) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cmd
import (
"testing"

fn "knative.dev/func"
"knative.dev/func/mock"
fn "knative.dev/func/pkg/functions"
"knative.dev/func/pkg/mock"
)

// TestList_Namespace ensures that list command options for specifying a
Expand Down
2 changes: 1 addition & 1 deletion cmd/prompt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/hinshun/vt10x"

"knative.dev/func/docker"
"knative.dev/func/pkg/docker"
)

func Test_newPromptForCredentials(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/ory/viper"
"github.com/spf13/cobra"

fn "knative.dev/func"
"knative.dev/func/config"
"knative.dev/func/pkg/config"
fn "knative.dev/func/pkg/functions"
)

// command constructors
Expand Down
2 changes: 1 addition & 1 deletion cmd/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"testing"

. "knative.dev/func/testing"
. "knative.dev/func/pkg/testing"
)

// TestRepository_List ensures that the 'list' subcommand shows the client's
Expand Down
Loading