resource

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

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

View Source
const (
	RuleFile         = "rule.go"
	UsedRuleJsonFile = "used_rules.json"
	EmbededFs        = "embededfs"
)

Variables

This section is empty.

Functions

func CopyAPITo

func CopyAPITo(target string, pkgName string) (string, error)

func CopyOtelSetupTo

func CopyOtelSetupTo(pkgName, target string) (string, error)

func CopyPkgTo

func CopyPkgTo(target string) error

func FindFileRuleByHash

func FindFileRuleByHash(hash uint64) *api.InstFileRule

func FindFuncRuleByHash

func FindFuncRuleByHash(hash uint64) *api.InstFuncRule

func FindRuleByHash

func FindRuleByHash(hash uint64) api.InstRule

func FindRuleFile

func FindRuleFile(path string) (string, error)

func FindRuleFiles

func FindRuleFiles(rule api.InstRule) ([]string, error)

func FindStructRuleByHash

func FindStructRuleByHash(hash uint64) *api.InstStructRule

func InitRules

func InitRules() error

func ReadRuleFile

func ReadRuleFile(path string) (string, error)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL