ab2d0ae6cb
This change eliminates boilerplate decoding logic in all the different data structures, and instead uses a new tag-directed decoding scheme. This works a lot like the JSON deserializers, in that it recognizes the `json:"name"` tags, except that we permit annotation of fields that require custom deserialization, as `json:"name,custom"`. The existing `json:"name,omitempty"` tag is recognized for optional fields.
26 lines
1 KiB
Go
26 lines
1 KiB
Go
// Copyright 2016 Marapongo, Inc. All rights reserved.
|
|
|
|
// This package contains the core MuPackage metadata types.
|
|
package pack
|
|
|
|
import (
|
|
"github.com/marapongo/mu/pkg/pack/ast"
|
|
"github.com/marapongo/mu/pkg/pack/symbols"
|
|
)
|
|
|
|
// Metadata is an informational section describing a package.
|
|
type Metadata struct {
|
|
Name string `json:"name"` // a required fully qualified name.
|
|
Description string `json:"description,omitempty"` // an optional informational description.
|
|
Author string `json:"author,omitempty"` // an optional author.
|
|
Website string `json:"website,omitempty"` // an optional website for additional info.
|
|
License string `json:"license,omitempty"` // an optional license governing this package's usage.
|
|
}
|
|
|
|
// Package is a top-level package definition.
|
|
type Package struct {
|
|
Metadata
|
|
|
|
Dependencies *[]symbols.ModuleToken `json:"dependencies,omitempty"` // all of the module dependencies.
|
|
Modules *ast.Modules `json:"modules,omitempty,custom"` // a collection of top-level modules.
|
|
}
|