Skip to content

Commit b0b5934

Browse files
committed
use %q format specifier
1 parent 2739c89 commit b0b5934

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
This project provides an automatic solution for Golang applications that want to
88
leverage OpenTelemetry to enable effective observability. No code changes are
9-
required in the target application, and the instrumentation is done at compile
10-
time. Simply replace `go build` with `otelbuild` to get started.
9+
required in the target application, the instrumentation is done at compile
10+
time. Simply replacing `go build` with `otelbuild` to get started :rocket:
1111

1212
# Installation
1313

1414
### Install via Bash
15-
For **Linux and MacOS** users, install the tool by running the following command :rocket:
15+
For **Linux and MacOS** users, install the tool by running the following command
1616
```bash
1717
$ sudo curl -fsSL https://cdn.jsdelivr.net/gh/alibaba/opentelemetry-go-auto-instrumentation@main/install.sh | sudo bash
1818
```

tool/preprocess/setup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (dp *DepProcessor) initRules(pkgName, target string) (err error) {
328328
imports[OtelGetStackImportPath] = OtelGetStackAliasPkg
329329
}
330330
for k, v := range imports {
331-
c += fmt.Sprintf("import %s \"%s\"\n", v, k)
331+
c += fmt.Sprintf("import %s %q\n", v, k)
332332
}
333333

334334
// Assignments

tool/shared/ast.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func addImport(root *dst.File, path string, force bool) {
246246
spec := &dst.ImportSpec{
247247
Path: &dst.BasicLit{
248248
Kind: token.STRING,
249-
Value: fmt.Sprintf("\"%s\"", path),
249+
Value: fmt.Sprintf("%q", path),
250250
},
251251
}
252252
if force {
@@ -273,7 +273,7 @@ func RemoveImport(root *dst.File, path string) *dst.ImportSpec {
273273
genDecl.Tok == token.IMPORT {
274274
for i, spec := range genDecl.Specs {
275275
if importSpec, ok := spec.(*dst.ImportSpec); ok {
276-
if importSpec.Path.Value == fmt.Sprintf("\"%s\"", path) {
276+
if importSpec.Path.Value == fmt.Sprintf("%q", path) {
277277
genDecl.Specs =
278278
append(genDecl.Specs[:i],
279279
genDecl.Specs[i+1:]...)

0 commit comments

Comments
 (0)