This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-go.git


The following commit(s) were added to refs/heads/main by this push:
     new f517611  Let Inject support relative directory (#75)
f517611 is described below

commit f51761120748d03a68ad9077444a9edbcde4c247
Author: mrproliu <[email protected]>
AuthorDate: Tue Jul 18 23:01:45 2023 +0800

    Let Inject support relative directory (#75)
---
 docs/en/setup/gobuild.md       | 2 +-
 tools/go-agent/cmd/injector.go | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/docs/en/setup/gobuild.md b/docs/en/setup/gobuild.md
index 53d3e96..7dd17aa 100644
--- a/docs/en/setup/gobuild.md
+++ b/docs/en/setup/gobuild.md
@@ -21,7 +21,7 @@ Please execute the following command, which would 
automatically import SkyWalkin
 ```
 
 * `/path/to/agent` is the path to the agent which your downloaded.
-* `/path/to/your/project` is the home path to your project.
+* `/path/to/your/project` is the home path to your project, support absolute 
and related with current directory path.
 * `-all` is the parameter for injecting all submodules in your project.
 
 ### 2.2 Code Dependency
diff --git a/tools/go-agent/cmd/injector.go b/tools/go-agent/cmd/injector.go
index 15525f2..e025cfc 100644
--- a/tools/go-agent/cmd/injector.go
+++ b/tools/go-agent/cmd/injector.go
@@ -54,11 +54,15 @@ func InjectProject(flags *EnhancementToolFlags) error {
        if version == "" {
                return fmt.Errorf("version is empty, please use the release 
version of skywalking-go")
        }
+       abs, err := filepath.Abs(flags.Inject)
+       if err != nil {
+               return err
+       }
        injector := &projectInjector{}
        if stat.IsDir() {
-               return injector.injectDir(flags.Inject, flags.AllProjects)
+               return injector.injectDir(abs, flags.AllProjects)
        }
-       return injector.injectFile(flags.Inject)
+       return injector.injectFile(abs)
 }
 
 func (i *projectInjector) injectDir(path string, allProjects bool) error {

Reply via email to