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

Syntax Error Due to Missing Semicolon in PDAs.md #97

Closed
hiroyukikumazawa opened this issue Feb 6, 2024 · 0 comments · Fixed by #98
Closed

Syntax Error Due to Missing Semicolon in PDAs.md #97

hiroyukikumazawa opened this issue Feb 6, 2024 · 0 comments · Fixed by #98
Labels
bug Something isn't working

Comments

@hiroyukikumazawa
Copy link
Contributor

Hello,

I've encountered a syntax error in the game module within the anchor_in_depth/PDAs.md file. Specifically, the issue arises from a missing semicolon at the end of the line where user_stats.bump is assigned. Here's the relevant code snippet:

use anchor_lang::prelude::*;

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

#[program]
pub mod game {
    use super::*;
    // handler function
    pub fn create_user_stats(ctx: Context<CreateUserStats>, name: String) -> Result<()> {
        let user_stats = &mut ctx.accounts.user_stats;
        user_stats.level = 0;
        if name.as_bytes().len() > 200 {
            // proper error handling omitted for brevity
            panic!();
        }
        user_stats.name = name;
        user_stats.bump = ctx.bumps.user_stats // Missing semicolon here

Issue:
The line user_stats.bump = ctx.bumps.user_stats is missing a semicolon at the end. This omission could lead to a compilation error, affecting developers who are trying to compile or run this example.

Expected Correction:
The line should end with a semicolon, as shown below:

user_stats.bump = ctx.bumps.user_stats;

Recommendation:
Please add the missing semicolon to ensure the code snippet compiles without errors. This small fix will help improve the documentation's accuracy and usability for developers exploring Anchor.

Thank you for your attention to this matter.

hiroyukikumazawa added a commit to hiroyukikumazawa/anchor-book that referenced this issue Feb 6, 2024
@acheroncrypto acheroncrypto added the bug Something isn't working label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants