Using your resource fails for me because of the following error:
packagepath: /tmp/build/put/rf-exceptions/bin/Release2022/12/21 10:44:14 error getting publish url from apierror getting Service Index 401
Please note: There's also an error in the string output concatenation.
This is because the custom host that I'm trying to publish to is a Nexus repository, which declines HTTP methods and requires HTTPS instead.
I believe this is due to your code:
func (client *nugetclientv3) GetServiceIndex(ctx context.Context) (*ServiceIndex, error) {
req, err := http.NewRequest(http.MethodGet, client.FeedURL, nil)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
req.Header.Add("accept", "application/json")
var netClient = &http.Client{
Timeout: 10 * time.Second,
}
res, err := netClient.Do(req)
if err != nil {
return nil, err
}
if res.StatusCode != 200 {
return nil, fmt.Errorf("error getting Service Index %d", res.StatusCode)
}
defer res.Body.Close()
var r ServiceIndex
if err := json.NewDecoder(res.Body).Decode(&r); err != nil {
return nil, err
}
return &r, nil
}
I'm not very familiar with go, so I might be wrong about the code part, but using HTTP for nexus repositories will not work, according to https://stackoverflow.com/questions/68370067/gradle-error-when-deploying-to-nexus-repository which explains the error.
When using the NuGet CLI manually, I can successfully push to the repository.
In the resource, I am providing a URI with HTTPS, so there's no wrong configuration on my side.
The API key is the same that I used manually in CLI.
Also, is this project still alive? There hasn't been much activity since years.
Using your resource fails for me because of the following error:
packagepath: /tmp/build/put/rf-exceptions/bin/Release2022/12/21 10:44:14 error getting publish url from apierror getting Service Index 401Please note: There's also an error in the string output concatenation.
This is because the custom host that I'm trying to publish to is a Nexus repository, which declines HTTP methods and requires HTTPS instead.
I believe this is due to your code:
I'm not very familiar with go, so I might be wrong about the code part, but using HTTP for nexus repositories will not work, according to https://stackoverflow.com/questions/68370067/gradle-error-when-deploying-to-nexus-repository which explains the error.
When using the NuGet CLI manually, I can successfully push to the repository.
In the resource, I am providing a URI with HTTPS, so there's no wrong configuration on my side.
The API key is the same that I used manually in CLI.
Also, is this project still alive? There hasn't been much activity since years.