Skip to content

Commit

Permalink
wip refacto 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Medzoner committed Oct 27, 2024
1 parent 6465b6f commit 3dfbfa7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion pkg/infra/tracer/http_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ func initLogger(ctx context.Context, conn *grpc.ClientConn) (func(context.Contex
lp := otelLog.NewLoggerProvider(
otelLog.WithProcessor(otelLog.NewBatchProcessor(logExporter)),
)

global.SetLoggerProvider(lp)

logger := otelslog.NewLogger(serviceName.Value.AsString())
Expand Down
5 changes: 1 addition & 4 deletions pkg/ui/http/templater/templater.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ func (t *TemplateHTML) Render(name string, view interface{}, response http.Respo
return nil, fmt.Errorf("error parsing templates: %v", err)
}

if err = htmlTemplate.ExecuteTemplate(response, name, view); err != nil {
return nil, fmt.Errorf("error executing template: %v", err)
}
return nil, nil
return nil, htmlTemplate.ExecuteTemplate(response, name, view)
}

// parseTemplates parses templates
Expand Down
13 changes: 9 additions & 4 deletions pkg/ui/http/templater/templater_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package templater_test

import (
"github.com/Medzoner/medzoner-go/pkg/ui/http/templater"
"gotest.tools/assert"
"github.com/Medzoner/medzoner-go/pkg/infra/config"
"net/http/httptest"
"os"
"testing"

"github.com/Medzoner/medzoner-go/pkg/ui/http/templater"

"gotest.tools/assert"
)

func TestRender(t *testing.T) {
rootPath := "../../../../"
t.Run("Unit: test Render success", func(t *testing.T) {
var tpl = templater.TemplateHTML{
RootPath: "../../../../",
cfg := config.Config{
RootPath: config.RootPath(rootPath),
}
var tpl = templater.NewTemplateHTML(cfg)
_, err := tpl.Render(
"index",
nil,
Expand Down

0 comments on commit 3dfbfa7

Please sign in to comment.