Verified Commit 278296f6 authored by Oleksandr Redko's avatar Oleksandr Redko Committed by GitLab
Browse files

docs: Replace gitlab.Ptr with new

Changelog: Improvements
parent b9ae546f
Loading
Loading
Loading
Loading
+10 −10
Changes for README.md: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ to list all projects for user "svanharmelen":

```go
git := gitlab.NewClient("yourtokengoeshere")
opt := &gitlab.ListProjectsOptions{Search: gitlab.Ptr("svanharmelen")}
opt := &gitlab.ListProjectsOptions{Search: new("svanharmelen")}
projects, _, err := git.Projects.ListProjects(opt)
```

@@ -76,11 +76,11 @@ func main() {

	// Create new project
	p := &gitlab.CreateProjectOptions{
		Name:                     gitlab.Ptr("My Project"),
		Description:              gitlab.Ptr("Just a test project to play with"),
		MergeRequestsAccessLevel: gitlab.Ptr(gitlab.EnabledAccessControl),
		SnippetsAccessLevel:      gitlab.Ptr(gitlab.EnabledAccessControl),
		Visibility:               gitlab.Ptr(gitlab.PublicVisibility),
		Name:                     new("My Project"),
		Description:              new("Just a test project to play with"),
		MergeRequestsAccessLevel: new(gitlab.EnabledAccessControl),
		SnippetsAccessLevel:      new(gitlab.EnabledAccessControl),
		Visibility:               new(gitlab.PublicVisibility),
	}
	project, _, err := git.Projects.CreateProject(p)
	if err != nil {
@@ -89,10 +89,10 @@ func main() {

	// Add a new snippet
	s := &gitlab.CreateProjectSnippetOptions{
		Title:      gitlab.Ptr("Dummy Snippet"),
		FileName:   gitlab.Ptr("snippet.go"),
		Content:    gitlab.Ptr("package main...."),
		Visibility: gitlab.Ptr(gitlab.PublicVisibility),
		Title:      new("Dummy Snippet"),
		FileName:   new("snippet.go"),
		Content:    new("package main...."),
		Visibility: new(gitlab.PublicVisibility),
	}
	_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
	if err != nil {