Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): fix import path with --nomod #2775

Merged
merged 2 commits into from
Jun 8, 2023
Merged

Conversation

haoqixu
Copy link
Contributor

@haoqixu haoqixu commented Mar 31, 2023

Description (what this PR does / why we need it):

kratos new --nomod generates codes with incorrect import paths.

kratos new project && cd project
kratos new --nomod app/user

which creates app/user/cmd/user/wire.go:

//go:build wireinject
// +build wireinject

// The build tag makes sure the stub is not built in the final build.

package main

import (
	"project/user/internal/biz"
	"project/user/internal/conf"
	"project/user/internal/data"
	"project/user/internal/server"
	"project/user/internal/service"

	"github.com/go-kratos/kratos/v2"
	"github.com/go-kratos/kratos/v2/log"
	"github.com/google/wire"
)

// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Data, log.Logger) (*kratos.App, func(), error) {
	panic(wire.Build(server.ProviderSet, data.ProviderSet, biz.ProviderSet, service.ProviderSet, newApp))
}

The correct prefix is project/app/user/internal/ and the paths generated by kratos start with project/user/internal/.

Other special notes for the reviewers:

This bug was introduced by #2714.

@uthng
Copy link

uthng commented May 10, 2023

Hi, thanks for the correction. I got the same issue. I just made a small modification as indicated in the code review to fix it.

I am very happy if this fix can be merged quickly.

Best regards,

NT

@haoqixu haoqixu force-pushed the main branch 2 times, most recently from 02ef6f3 to fbcf8d2 Compare May 10, 2023 06:54
@haoqixu
Copy link
Contributor Author

haoqixu commented May 10, 2023

Friendly ping @shenqidebaozi @haiyux @demoManito

@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


friendly ping @神奇的包子@左住@的MOMA你to

@haoqixu
Copy link
Contributor Author

haoqixu commented Jun 1, 2023

related PRs and Issue #2837 #2851 #2852

@shenqidebaozi shenqidebaozi merged commit e86ad24 into go-kratos:main Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants