clickhouse-operator icon indicating copy to clipboard operation
clickhouse-operator copied to clipboard

Symlink makes it impossible to import package

Open erikdubbelboer opened this issue 3 years ago • 4 comments

Go doesn't follow symlink in import parts. Because of this symlink it is now impossible to import this package:

% cat main.go
package main

import "github.com/altinity/clickhouse-operator/pkg/apis/metrics"

func main() {
	_ = metrics.NewExporter
}

% go mod tidy
go: finding module for package github.com/altinity/clickhouse-operator/pkg/apis/metrics
go: found github.com/altinity/clickhouse-operator/pkg/apis/metrics in github.com/altinity/clickhouse-operator v0.0.0-20220307063955-cecb54ad1ade
go: finding module for package github.com/altinity/clickhouse-operator/pkg/client/clientset/versioned
example imports
	github.com/altinity/clickhouse-operator/pkg/apis/metrics imports
	github.com/altinity/clickhouse-operator/pkg/client/clientset/versioned: module github.com/altinity/clickhouse-operator@latest found (v0.0.0-20220307063955-cecb54ad1ade), but does not contain package github.com/altinity/clickhouse-operator/pkg/client/clientset/versioned

I suggest that all import statements get changed to the new path. I don't see any reason to keep the old imports and have this symlink in place.

erikdubbelboer avatar Mar 14 '22 07:03 erikdubbelboer

We didn't assume use parts of clickhouse-operator code will use as library

If you want to scrape clickhouse via prometheus I propose to use embedded prometheus endpoint Look to https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/#server_configuration_parameters-prometheus and https://grafana.com/grafana/dashboards/13500

Slach avatar Mar 14 '22 07:03 Slach

The clickhouse prometheus endpoint doesn't expose enough to make the Altinity alerts config work. What is the harm in making it possible to import code from this package? We have successfully done this for the last year. The only thing that needs to change now is this symlink.

erikdubbelboer avatar Mar 14 '22 07:03 erikdubbelboer

What is the harm in making it possible to import code from this package

We could change it in future and not have resource to maintain it as library with backwards compatibility

Slach avatar Mar 14 '22 08:03 Slach

You don't have to guarantee backwards compatibility. I don't care if you break backwards compatibility, people can just change their code to match your changes. But being able to import in the past and not being able to import now is annoying.

erikdubbelboer avatar Mar 14 '22 08:03 erikdubbelboer

code generator reworked please check 0.23.3 version hope it helps

sunsingerus avatar Feb 15 '24 15:02 sunsingerus