Skip to content

Commit

Permalink
Change to private field in assetTypeFolder
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm committed Jul 11, 2024
1 parent c194660 commit ec4daea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/packages/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ import (
type AssetType string

type assetTypeFolder struct {
Type AssetType
typeName AssetType
folderName string
}

func newAssetType(typeName AssetType) assetTypeFolder {
return assetTypeFolder{
Type: typeName,
typeName: typeName,
folderName: string(typeName),
}
}
func newAssetTypeWithFolder(typeName AssetType, folderName string) assetTypeFolder {
return assetTypeFolder{
Type: typeName,
typeName: typeName,
folderName: folderName,
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func loadElasticsearchAssets(pkgRootPath string) ([]Asset, error) {

asset := Asset{
ID: indexTemplateName,
Type: AssetTypeElasticsearchIndexTemplate.Type,
Type: AssetTypeElasticsearchIndexTemplate.typeName,
DataStream: dsManifest.Name,
}
assets = append(assets, asset)
Expand Down Expand Up @@ -167,7 +167,7 @@ func loadElasticsearchAssets(pkgRootPath string) ([]Asset, error) {
}
asset = Asset{
ID: ingestPipelineName,
Type: AssetTypeElasticsearchIngestPipeline.Type,
Type: AssetTypeElasticsearchIngestPipeline.typeName,
DataStream: dsManifest.Name,
}
assets = append(assets, asset)
Expand All @@ -186,12 +186,12 @@ func loadFileBasedAssets(kibanaAssetsFolderPath string, assetType assetTypeFolde
return nil, nil
}
if err != nil {
return nil, fmt.Errorf("error finding kibana %s assets folder: %w", assetType.Type, err)
return nil, fmt.Errorf("error finding kibana %s assets folder: %w", assetType.typeName, err)
}

paths, err := filepath.Glob(filepath.Join(assetsFolderPath, "*.json"))
if err != nil {
return nil, fmt.Errorf("could not read %s files: %w", assetType.Type, err)
return nil, fmt.Errorf("could not read %s files: %w", assetType.typeName, err)
}

var assets []Asset
Expand All @@ -203,7 +203,7 @@ func loadFileBasedAssets(kibanaAssetsFolderPath string, assetType assetTypeFolde

asset := Asset{
ID: assetID,
Type: assetType.Type,
Type: assetType.typeName,
SourcePath: assetPath,
}
assets = append(assets, asset)
Expand Down

0 comments on commit ec4daea

Please sign in to comment.