@@ -34,7 +34,10 @@ import (
3434 v1 "github.com/opencontainers/image-spec/specs-go/v1"
3535)
3636
37- const OCI_REMOTE_ENABLED = "COMPOSE_EXPERIMENTAL_OCI_REMOTE"
37+ const (
38+ OCI_REMOTE_ENABLED = "COMPOSE_EXPERIMENTAL_OCI_REMOTE"
39+ OciPrefix = "oci://"
40+ )
3841
3942func ociRemoteLoaderEnabled () (bool , error ) {
4043 if v := os .Getenv (OCI_REMOTE_ENABLED ); v != "" {
@@ -61,10 +64,8 @@ type ociRemoteLoader struct {
6164 known map [string ]string
6265}
6366
64- const prefix = "oci://"
65-
6667func (g ociRemoteLoader ) Accept (path string ) bool {
67- return strings .HasPrefix (path , prefix )
68+ return strings .HasPrefix (path , OciPrefix )
6869}
6970
7071func (g ociRemoteLoader ) Load (ctx context.Context , path string ) (string , error ) {
@@ -82,7 +83,7 @@ func (g ociRemoteLoader) Load(ctx context.Context, path string) (string, error)
8283
8384 local , ok := g .known [path ]
8485 if ! ok {
85- ref , err := reference .ParseDockerRef (path [len (prefix ):])
86+ ref , err := reference .ParseDockerRef (path [len (OciPrefix ):])
8687 if err != nil {
8788 return "" , err
8889 }
@@ -121,7 +122,6 @@ func (g ociRemoteLoader) Load(ctx context.Context, path string) (string, error)
121122 }
122123 g .known [path ] = local
123124 }
124-
125125 return filepath .Join (local , "compose.yaml" ), nil
126126}
127127
0 commit comments