Documentation ¶
Overview ¶
Copyright (c) 2024 Alibaba Group Holding Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2024 Alibaba Group Holding Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CopyAPITo(target string, pkgName string) (string, error)
- func CopyOtelSetupTo(pkgName, target string) (string, error)
- func CopyPkgTo(target string) error
- func FindFileRuleByHash(hash uint64) *api.InstFileRule
- func FindFuncRuleByHash(hash uint64) *api.InstFuncRule
- func FindRuleByHash(hash uint64) api.InstRule
- func FindRuleFile(path string) (string, error)
- func FindRuleFiles(rule api.InstRule) ([]string, error)
- func FindStructRuleByHash(hash uint64) *api.InstStructRule
- func InitRules() error
- func ReadRuleFile(path string) (string, error)
- func StoreRuleBundles(bundles []*RuleBundle) error
- type RuleBundle
- func (rb *RuleBundle) AddFile2FuncRule(file string, rule *api.InstFuncRule)
- func (rb *RuleBundle) AddFile2StructRule(file string, rule *api.InstStructRule)
- func (rb *RuleBundle) AddFileRule(rule *api.InstFileRule)
- func (rb *RuleBundle) IsValid() bool
- func (rb *RuleBundle) Merge(new *RuleBundle) (*RuleBundle, error)
Constants ¶
const ( RuleFile = "rule.go" UsedRuleJsonFile = "used_rules.json" EmbededFs = "embededfs" )
Variables ¶
This section is empty.
Functions ¶
func CopyOtelSetupTo ¶
func FindFileRuleByHash ¶
func FindFileRuleByHash(hash uint64) *api.InstFileRule
func FindFuncRuleByHash ¶
func FindFuncRuleByHash(hash uint64) *api.InstFuncRule
func FindRuleByHash ¶
func FindRuleFile ¶
func FindStructRuleByHash ¶
func FindStructRuleByHash(hash uint64) *api.InstStructRule
func ReadRuleFile ¶
func StoreRuleBundles ¶
func StoreRuleBundles(bundles []*RuleBundle) error
Types ¶
type RuleBundle ¶
type RuleBundle struct { PackageName string // Short package name, e.g. "echo" ImportPath string // Full import path, e.g. "github.com/labstack/echo/v4" FileRules []uint64 // File rules File2FuncRules map[string]map[string][]uint64 File2StructRules map[string]map[string][]uint64 }
RuleBundle is a collection of rules that matched with one compilation action
func LoadRuleBundles ¶
func LoadRuleBundles() ([]*RuleBundle, error)
func NewRuleBundle ¶
func NewRuleBundle(importPath string) *RuleBundle
func (*RuleBundle) AddFile2FuncRule ¶
func (rb *RuleBundle) AddFile2FuncRule(file string, rule *api.InstFuncRule)
func (*RuleBundle) AddFile2StructRule ¶
func (rb *RuleBundle) AddFile2StructRule(file string, rule *api.InstStructRule)
func (*RuleBundle) AddFileRule ¶
func (rb *RuleBundle) AddFileRule(rule *api.InstFileRule)
func (*RuleBundle) IsValid ¶
func (rb *RuleBundle) IsValid() bool
func (*RuleBundle) Merge ¶
func (rb *RuleBundle) Merge(new *RuleBundle) (*RuleBundle, error)