From 153484becbc74cf0e573253a4c1bd8f7cbc0371b Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Fri, 5 Jan 2024 18:33:51 +0800 Subject: [PATCH] remove comments, make getTrackingString take a pointer receiver Signed-off-by: Yee Hing Tong --- flyteartifacts/pkg/lib/url_parse.go | 6 +----- flyteartifacts/pkg/server/service.go | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/flyteartifacts/pkg/lib/url_parse.go b/flyteartifacts/pkg/lib/url_parse.go index cf4f1023ca..3d15d80ac6 100644 --- a/flyteartifacts/pkg/lib/url_parse.go +++ b/flyteartifacts/pkg/lib/url_parse.go @@ -24,11 +24,7 @@ func ParseFlyteURL(urlStr string) (core.ArtifactID, error) { if err != nil { return core.ArtifactID{}, err } - //projectDomainName := strings.Split(strings.Trim(parsed.Path, "/"), "/") - //if len(projectDomainName) < 3 { - // return core.ArtifactID{}, errors.New("invalid URL format") - //} - //project, domain, name := projectDomainName[0], projectDomainName[1], strings.Join(projectDomainName[2:], "/") + var project, domain, name, version string queryDict := make(map[string]string) diff --git a/flyteartifacts/pkg/server/service.go b/flyteartifacts/pkg/server/service.go index 570902fda7..8fc4e06da5 100644 --- a/flyteartifacts/pkg/server/service.go +++ b/flyteartifacts/pkg/server/service.go @@ -18,7 +18,7 @@ type CoreService struct { } // This string is a tracker basically that will be installed in the metadata of the literal. See the ArtifactKey constant for more information. -func (c *CoreService) getTrackingString(request artifact.CreateArtifactRequest) string { +func (c *CoreService) getTrackingString(request *artifact.CreateArtifactRequest) string { ak := request.ArtifactKey t := fmt.Sprintf("%s/%s/%s@%s", ak.Project, ak.Domain, ak.Name, request.Version) @@ -36,7 +36,7 @@ func (c *CoreService) CreateArtifact(ctx context.Context, request *artifact.Crea if request.GetSpec().GetValue().Metadata == nil { request.GetSpec().GetValue().Metadata = make(map[string]string, 1) } - trackingStr := c.getTrackingString(*request) + trackingStr := c.getTrackingString(request) request.GetSpec().GetValue().Metadata[lib.ArtifactKey] = trackingStr artifactObj, err := models.CreateArtifactModelFromRequest(ctx, request.ArtifactKey, request.Spec, request.Version, request.Partitions, request.Tag, request.Source)